parent
5c350e4d3d
commit
c92addf821
1 changed files with 6 additions and 2 deletions
|
@ -1221,6 +1221,7 @@ module ts {
|
|||
var program: Program;
|
||||
var typeChecker: TypeChecker;
|
||||
var useCaseSensitivefilenames = false;
|
||||
var documentsByName: Map<SourceFile> = {};
|
||||
var documentRegistry = documentRegistry;
|
||||
var cancellationToken = new CancellationTokenObject(host.getCancellationToken());
|
||||
var activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details
|
||||
|
@ -1231,8 +1232,7 @@ module ts {
|
|||
}
|
||||
|
||||
function getSourceFile(filename: string): SourceFile {
|
||||
Debug.assert(!!program, "'getSoruceFile(filename)' is called before 'program' is initialized, consider calling 'synchronizeHostData()' first");
|
||||
return program.getSourceFile(filename);
|
||||
return lookUp(documentsByName, filename);
|
||||
}
|
||||
|
||||
function createCompilerHost(): CompilerHost {
|
||||
|
@ -1291,6 +1291,7 @@ module ts {
|
|||
var filename = oldSourceFiles[i].filename;
|
||||
if (!hostCache.contains(filename) || changesInCompilationSettingsAffectSyntax) {
|
||||
documentRegistry.releaseDocument(filename, oldSettings);
|
||||
delete documentsByName[filename];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1332,6 +1333,9 @@ module ts {
|
|||
else {
|
||||
sourceFile = documentRegistry.acquireDocument(filename, compilationSettings, scriptSnapshot, hostCache.getByteOrderMark(filename), version, isOpen, []);
|
||||
}
|
||||
|
||||
// Remeber the new sourceFile
|
||||
documentsByName[filename] = sourceFile;
|
||||
}
|
||||
|
||||
// Now create a new compiler
|
||||
|
|
Loading…
Reference in a new issue