Skip to content

Commit 5c98b9c

Browse files
committed
Revert the fix
1 parent c8ebfb8 commit 5c98b9c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/compiler/program.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ namespace ts {
171171
const readFileCache = new Map<string, string | false>();
172172
const fileExistsCache = new Map<string, boolean>();
173173
const directoryExistsCache = new Map<string, boolean>();
174-
const sourceFileCache = new Map<string, ESMap<SourceFile["impliedNodeFormat"], SourceFile>>();
174+
const sourceFileCache = new Map<string, SourceFile>();
175175

176176
const readFileWithCache = (fileName: string): string | undefined => {
177177
const key = toPath(fileName);
@@ -196,16 +196,14 @@ namespace ts {
196196
return setReadFileCache(key, fileName);
197197
};
198198

199-
const getSourceFileWithCache: CompilerHost["getSourceFile"] | undefined = getSourceFile ? (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) => {
199+
const getSourceFileWithCache: CompilerHost["getSourceFile"] | undefined = getSourceFile ? (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
200200
const key = toPath(fileName);
201-
const impliedNodeFormat: SourceFile["impliedNodeFormat"] = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined;
202-
const forPath = sourceFileCache.get(key);
203-
const value = forPath?.get(impliedNodeFormat);
201+
const value = sourceFileCache.get(key);
204202
if (value) return value;
205203

206-
const sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile);
204+
const sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
207205
if (sourceFile && (isDeclarationFileName(fileName) || fileExtensionIs(fileName, Extension.Json))) {
208-
sourceFileCache.set(key, (forPath || new Map()).set(impliedNodeFormat, sourceFile));
206+
sourceFileCache.set(key, sourceFile);
209207
}
210208
return sourceFile;
211209
} : undefined;
@@ -230,8 +228,7 @@ namespace ts {
230228
sourceFileCache.delete(key);
231229
}
232230
else if (getSourceFileWithCache) {
233-
const sourceFileMap = sourceFileCache.get(key);
234-
const sourceFile = sourceFileMap && firstDefinedIterator(sourceFileMap.values(), identity);
231+
const sourceFile = sourceFileCache.get(key);
235232
if (sourceFile && sourceFile.text !== data) {
236233
sourceFileCache.delete(key);
237234
}

0 commit comments

Comments
 (0)