File tree 1 file changed +7
-10
lines changed
1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -277,11 +277,10 @@ module ts {
277
277
// specified since the last compilation cycle.
278
278
removeWatchers ( program ) ;
279
279
280
- // Gets us syntactically correct files from the last compilation.
281
- var oldSourceFiles = arrayToMap ( program . getSourceFiles ( ) , file => getCanonicalName ( file . filename ) ) ;
282
-
283
- // No longer using the old program.
284
- program = undefined ;
280
+ // Reuse source files from the last compilation so long as they weren't changed.
281
+ var oldSourceFiles = arrayToMap (
282
+ filter ( program . getSourceFiles ( ) , file => ! hasProperty ( changedFiles , getCanonicalName ( file . filename ) ) ) ,
283
+ file => getCanonicalName ( file . filename ) ) ;
285
284
286
285
// We create a new compiler host for this compilation cycle.
287
286
// This new host is effectively the same except that 'getSourceFile'
@@ -291,11 +290,9 @@ module ts {
291
290
newCompilerHost . getSourceFile = ( fileName , languageVersion , onError ) => {
292
291
fileName = getCanonicalName ( fileName ) ;
293
292
294
- if ( ! hasProperty ( changedFiles , fileName ) ) {
295
- var sourceFile = lookUp ( oldSourceFiles , fileName ) ;
296
- if ( sourceFile ) {
297
- return sourceFile ;
298
- }
293
+ var sourceFile = lookUp ( oldSourceFiles , fileName ) ;
294
+ if ( sourceFile ) {
295
+ return sourceFile ;
299
296
}
300
297
301
298
return compilerHost . getSourceFile ( fileName , languageVersion , onError ) ;
You can’t perform that action at this time.
0 commit comments