Skip to content

Commit c909bec

Browse files
committed
Rename indexing variable
1 parent c1edbb8 commit c909bec

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/compiler/builder.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,11 @@ namespace ts {
265265
const { affectedFilesPendingEmit } = state;
266266
if (affectedFilesPendingEmit) {
267267
const seenEmittedFiles = state.seenEmittedFiles || (state.seenEmittedFiles = createMap());
268-
for (let affectedFilesIndex = state.affectedFilesPendingEmitIndex!; affectedFilesIndex < affectedFilesPendingEmit.length; affectedFilesIndex++) {
269-
const affectedFile = Debug.assertDefined(state.program).getSourceFileByPath(affectedFilesPendingEmit[affectedFilesIndex]);
268+
for (let i = state.affectedFilesPendingEmitIndex!; i < affectedFilesPendingEmit.length; i++) {
269+
const affectedFile = Debug.assertDefined(state.program).getSourceFileByPath(affectedFilesPendingEmit[i]);
270270
if (affectedFile && !seenEmittedFiles.has(affectedFile.path)) {
271271
// emit this file
272-
state.affectedFilesPendingEmitIndex = affectedFilesIndex;
272+
state.affectedFilesPendingEmitIndex = i;
273273
return affectedFile;
274274
}
275275
}
@@ -695,6 +695,10 @@ namespace ts {
695695
// In case of emit builder, cache the files to be emitted
696696
if (affectedFilesPendingEmit) {
697697
state.affectedFilesPendingEmit = concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
698+
// affectedFilesPendingEmitIndex === undefined
699+
// - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
700+
// so start from 0 as array would be affectedFilesPendingEmit
701+
// else, continue to iterate from existing index, the current set is appended to existing files
698702
if (state.affectedFilesPendingEmitIndex === undefined) {
699703
state.affectedFilesPendingEmitIndex = 0;
700704
}

0 commit comments

Comments
 (0)