Handle the fact that noResolveResolution resolution is reused

Fixes #39795
This commit is contained in:
Sheetal Nandi 2020-08-03 14:28:33 -07:00 committed by Daniel Rosenwasser
parent 1763b8e5f2
commit eeea32be29

View File

@ -406,7 +406,7 @@ namespace ts {
perDirectoryResolution.set(name, resolution);
}
resolutionsInFile.set(name, resolution);
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, noResolveResolution);
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
if (existingResolution) {
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
}
@ -561,7 +561,6 @@ namespace ts {
resolution: T,
filePath: Path,
getResolutionWithResolvedFileName: GetResolutionWithResolvedFileName<T, R>,
noResolveResolution: T
) {
if (resolution.refCount) {
resolution.refCount++;
@ -569,7 +568,7 @@ namespace ts {
}
else {
resolution.refCount = 1;
Debug.assert(resolution.files === undefined || (resolution === noResolveResolution && length(noResolveResolution.files) === 0));
Debug.assert(length(resolution.files) === 0); // This resolution shouldnt be referenced by any file yet
if (isExternalModuleNameRelative(name)) {
watchFailedLookupLocationOfResolution(resolution);
}