@@ -362,9 +362,7 @@ namespace ts {
362
362
}
363
363
364
364
function getOrCreateCacheForModuleName ( nonRelativeModuleName : string ) : PerModuleNameCache {
365
- if ( isExternalModuleNameRelative ( nonRelativeModuleName ) ) {
366
- return undefined ! ; // TODO: GH#18217
367
- }
365
+ Debug . assert ( ! isExternalModuleNameRelative ( nonRelativeModuleName ) ) ;
368
366
let perModuleNameCache = moduleNameToDirectoryMap . get ( nonRelativeModuleName ) ;
369
367
if ( ! perModuleNameCache ) {
370
368
perModuleNameCache = createPerModuleNameCache ( ) ;
@@ -493,10 +491,9 @@ namespace ts {
493
491
494
492
if ( perFolderCache ) {
495
493
perFolderCache . set ( moduleName , result ) ;
496
- // put result in per-module name cache
497
- const perModuleNameCache = cache ! . getOrCreateCacheForModuleName ( moduleName ) ;
498
- if ( perModuleNameCache ) {
499
- perModuleNameCache . set ( containingDirectory , result ) ;
494
+ if ( ! isExternalModuleNameRelative ( moduleName ) ) {
495
+ // put result in per-module name cache
496
+ cache ! . getOrCreateCacheForModuleName ( moduleName ) . set ( containingDirectory , result ) ;
500
497
}
501
498
}
502
499
}
@@ -1253,9 +1250,9 @@ namespace ts {
1253
1250
if ( resolvedUsingSettings ) {
1254
1251
return { value : resolvedUsingSettings } ;
1255
1252
}
1256
- const perModuleNameCache = cache && cache . getOrCreateCacheForModuleName ( moduleName ) ;
1257
1253
1258
1254
if ( ! isExternalModuleNameRelative ( moduleName ) ) {
1255
+ const perModuleNameCache = cache && cache . getOrCreateCacheForModuleName ( moduleName ) ;
1259
1256
// Climb up parent directories looking for a module.
1260
1257
const resolved = forEachAncestorDirectory ( containingDirectory , directory => {
1261
1258
const resolutionFromCache = tryFindNonRelativeModuleNameInCache ( perModuleNameCache , moduleName , directory , traceEnabled , host , failedLookupLocations ) ;
0 commit comments