@@ -88,7 +88,7 @@ var ts;
88
88
// If changing the text in this section, be sure to test `configureNightly` too.
89
89
ts.versionMajorMinor = "3.1";
90
90
/** The version of the TypeScript compiler release */
91
- ts.version = ts.versionMajorMinor + ".5 ";
91
+ ts.version = ts.versionMajorMinor + ".6 ";
92
92
})(ts || (ts = {}));
93
93
(function (ts) {
94
94
/* @internal */
@@ -84375,7 +84375,7 @@ var ts;
84375
84375
var diagnosticsProducingTypeChecker;
84376
84376
var noDiagnosticsTypeChecker;
84377
84377
var classifiableNames;
84378
- var modifiedFilePaths ;
84378
+ var ambientModuleNameToUnmodifiedFileName = ts.createMap() ;
84379
84379
var cachedSemanticDiagnosticsForFile = {};
84380
84380
var cachedDeclarationDiagnosticsForFile = {};
84381
84381
var resolvedTypeReferenceDirectives = ts.createMap();
@@ -84619,13 +84619,13 @@ var ts;
84619
84619
}
84620
84620
return classifiableNames;
84621
84621
}
84622
- function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState ) {
84622
+ function resolveModuleNamesReusingOldState(moduleNames, containingFile, file) {
84623
84623
if (structuralIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
84624
84624
// If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules,
84625
84625
// the best we can do is fallback to the default logic.
84626
84626
return resolveModuleNamesWorker(moduleNames, containingFile);
84627
84627
}
84628
- var oldSourceFile = oldProgramState.program && oldProgramState.program .getSourceFile(containingFile);
84628
+ var oldSourceFile = oldProgram && oldProgram .getSourceFile(containingFile);
84629
84629
if (oldSourceFile !== file && file.resolvedModules) {
84630
84630
// `file` was created for the new program.
84631
84631
//
@@ -84688,7 +84688,7 @@ var ts;
84688
84688
}
84689
84689
}
84690
84690
else {
84691
- resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, oldProgramState );
84691
+ resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
84692
84692
}
84693
84693
if (resolvesToAmbientModuleInNonModifiedFile) {
84694
84694
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
@@ -84725,12 +84725,9 @@ var ts;
84725
84725
return result;
84726
84726
// If we change our policy of rechecking failed lookups on each program create,
84727
84727
// we should adjust the value returned here.
84728
- function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) {
84729
- if (!oldProgramState.program) {
84730
- return false;
84731
- }
84732
- var resolutionToFile = ts.getResolvedModule(oldProgramState.oldSourceFile, moduleName); // TODO: GH#18217
84733
- var resolvedFile = resolutionToFile && oldProgramState.program.getSourceFile(resolutionToFile.resolvedFileName);
84728
+ function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
84729
+ var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
84730
+ var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
84734
84731
if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) {
84735
84732
// In the old program, we resolved to an ambient module that was in the same
84736
84733
// place as we expected to find an actual module file.
@@ -84739,12 +84736,12 @@ var ts;
84739
84736
return false;
84740
84737
}
84741
84738
// at least one of declarations should come from non-modified source file
84742
- var firstUnmodifiedFile = oldProgramState.program.getSourceFiles().find(function (f) { return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && ts.contains(f.ambientModuleNames, moduleName); } );
84743
- if (!firstUnmodifiedFile ) {
84739
+ var unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get( moduleName);
84740
+ if (!unmodifiedFile ) {
84744
84741
return false;
84745
84742
}
84746
84743
if (ts.isTraceEnabled(options, host)) {
84747
- ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName );
84744
+ ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, unmodifiedFile );
84748
84745
}
84749
84746
return true;
84750
84747
}
@@ -84914,15 +84911,23 @@ var ts;
84914
84911
if (oldProgram.structureIsReused !== 2 /* Completely */) {
84915
84912
return oldProgram.structureIsReused;
84916
84913
}
84917
- modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; });
84914
+ var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
84915
+ for (var _a = 0, oldSourceFiles_3 = oldSourceFiles; _a < oldSourceFiles_3.length; _a++) {
84916
+ var oldFile = oldSourceFiles_3[_a];
84917
+ if (!ts.contains(modifiedFiles, oldFile)) {
84918
+ for (var _b = 0, _c = oldFile.ambientModuleNames; _b < _c.length; _b++) {
84919
+ var moduleName = _c[_b];
84920
+ ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
84921
+ }
84922
+ }
84923
+ }
84918
84924
// try to verify results of module resolution
84919
- for (var _a = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _a < modifiedSourceFiles_1.length; _a ++) {
84920
- var _b = modifiedSourceFiles_1[_a ], oldSourceFile = _b .oldFile, newSourceFile = _b .newFile;
84925
+ for (var _d = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _d < modifiedSourceFiles_1.length; _d ++) {
84926
+ var _e = modifiedSourceFiles_1[_d ], oldSourceFile = _e .oldFile, newSourceFile = _e .newFile;
84921
84927
var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.originalFileName, currentDirectory);
84922
84928
if (resolveModuleNamesWorker) {
84923
84929
var moduleNames = getModuleNames(newSourceFile);
84924
- var oldProgramState = { program: oldProgram, oldSourceFile: oldSourceFile, modifiedFilePaths: modifiedFilePaths };
84925
- var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, oldProgramState);
84930
+ var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile);
84926
84931
// ensure that module resolution results are still correct
84927
84932
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);
84928
84933
if (resolutionsChanged) {
@@ -84965,8 +84970,8 @@ var ts;
84965
84970
}
84966
84971
files = newSourceFiles;
84967
84972
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
84968
- for (var _c = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _c < modifiedSourceFiles_2.length; _c ++) {
84969
- var modifiedFile = modifiedSourceFiles_2[_c ];
84973
+ for (var _f = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _f < modifiedSourceFiles_2.length; _f ++) {
84974
+ var modifiedFile = modifiedSourceFiles_2[_f ];
84970
84975
fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile);
84971
84976
}
84972
84977
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
@@ -85874,8 +85879,7 @@ var ts;
85874
85879
if (file.imports.length || file.moduleAugmentations.length) {
85875
85880
// Because global augmentation doesn't have string literal name, we can check for global augmentation as such.
85876
85881
var moduleNames = getModuleNames(file);
85877
- var oldProgramState = { program: oldProgram, oldSourceFile: oldProgram && oldProgram.getSourceFile(file.fileName), modifiedFilePaths: modifiedFilePaths };
85878
- var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.originalFileName, currentDirectory), file, oldProgramState);
85882
+ var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.originalFileName, currentDirectory), file);
85879
85883
ts.Debug.assert(resolutions.length === moduleNames.length);
85880
85884
for (var i = 0; i < moduleNames.length; i++) {
85881
85885
var resolution = resolutions[i];
0 commit comments