addressed PR feedback

This commit is contained in:
Vladimir Matveev
2015-10-23 13:09:05 -07:00
parent 7158a65b15
commit 19a222e718

View File

@@ -159,6 +159,8 @@ namespace ts {
let timerHandleForRecompilation: number; // Handle for 0.25s wait timer to trigger recompilation
let timerHandleForDirectoryChanges: number; // Handle for 0.25s wait timer to trigger directory change handler
// This map stores and reuses results of fileExists check that happen inside 'createProgram'
// This allows to save time in module resolution heavy scenarios when existence of the same file might be checked multiple times.
let cachedExistingFiles: Map<boolean>;
let hostFileExists: typeof compilerHost.fileExists;
@@ -279,7 +281,7 @@ namespace ts {
compilerHost.getSourceFile = getSourceFile;
hostFileExists = compilerHost.fileExists;
compilerHost.fileExists = fileExists;
compilerHost.fileExists = cachedFileExists;
}
// reset the cache of existing files
@@ -295,7 +297,7 @@ namespace ts {
reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
}
function fileExists(fileName: string): boolean {
function cachedFileExists(fileName: string): boolean {
if (hasProperty(cachedExistingFiles, fileName)) {
return cachedExistingFiles[fileName];
}