Addressed code review feedback.
This commit is contained in:
parent
6f563b7af9
commit
bd06e77b18
1 changed files with 7 additions and 10 deletions
|
@ -277,11 +277,10 @@ module ts {
|
||||||
// specified since the last compilation cycle.
|
// specified since the last compilation cycle.
|
||||||
removeWatchers(program);
|
removeWatchers(program);
|
||||||
|
|
||||||
// Gets us syntactically correct files from the last compilation.
|
// Reuse source files from the last compilation so long as they weren't changed.
|
||||||
var oldSourceFiles = arrayToMap(program.getSourceFiles(), file => getCanonicalName(file.filename));
|
var oldSourceFiles = arrayToMap(
|
||||||
|
filter(program.getSourceFiles(), file => !hasProperty(changedFiles, getCanonicalName(file.filename))),
|
||||||
// No longer using the old program.
|
file => getCanonicalName(file.filename));
|
||||||
program = undefined;
|
|
||||||
|
|
||||||
// We create a new compiler host for this compilation cycle.
|
// We create a new compiler host for this compilation cycle.
|
||||||
// This new host is effectively the same except that 'getSourceFile'
|
// This new host is effectively the same except that 'getSourceFile'
|
||||||
|
@ -291,11 +290,9 @@ module ts {
|
||||||
newCompilerHost.getSourceFile = (fileName, languageVersion, onError) => {
|
newCompilerHost.getSourceFile = (fileName, languageVersion, onError) => {
|
||||||
fileName = getCanonicalName(fileName);
|
fileName = getCanonicalName(fileName);
|
||||||
|
|
||||||
if (!hasProperty(changedFiles, fileName)) {
|
var sourceFile = lookUp(oldSourceFiles, fileName);
|
||||||
var sourceFile = lookUp(oldSourceFiles, fileName);
|
if (sourceFile) {
|
||||||
if (sourceFile) {
|
return sourceFile;
|
||||||
return sourceFile;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return compilerHost.getSourceFile(fileName, languageVersion, onError);
|
return compilerHost.getSourceFile(fileName, languageVersion, onError);
|
||||||
|
|
Loading…
Reference in a new issue