Skip to content

Commit 42c478f

Browse files
committed
Tweaked the new source enumerator implementation so it enumerates files in the same order as the old implementation. The order that files are type checked shouldn't theoretically matter, but in practice there can be minor differences (e.g. union order in error messages).
1 parent b8688e7 commit 42c478f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/pyright-internal/src/analyzer/sourceEnumerator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class SourceEnumerator {
4444
private _fs: FileSystem,
4545
private _console: ConsoleInterface
4646
) {
47-
this._includesToExplore = include.slice(0);
47+
this._includesToExplore = include.slice(0).reverse();
4848

4949
this._console.log(`Searching for source files`);
5050
}
@@ -104,13 +104,13 @@ export class SourceEnumerator {
104104

105105
// Performs the next enumeration action. Returns true if complete.
106106
private _doNext(): boolean {
107-
const dirToExplore = this._dirsToExplore.shift();
107+
const dirToExplore = this._dirsToExplore.pop();
108108
if (dirToExplore) {
109109
this._exploreDir(dirToExplore);
110110
return false;
111111
}
112112

113-
const includeToExplore = this._includesToExplore.shift();
113+
const includeToExplore = this._includesToExplore.pop();
114114
if (includeToExplore) {
115115
this._exploreInclude(includeToExplore);
116116
return false;
@@ -149,7 +149,7 @@ export class SourceEnumerator {
149149
}
150150
}
151151

152-
for (const subDir of directories) {
152+
for (const subDir of directories.slice().reverse()) {
153153
if (subDir.matchesRegex(dir.includeRegExp) || dir.hasDirectoryWildcard) {
154154
if (!FileSpec.isInPath(subDir, this._excludes)) {
155155
this._dirsToExplore.push({

0 commit comments

Comments
 (0)