mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
fix handling if there is no commonPrefix
This commit is contained in:
parent
20442fe363
commit
d2dc17d765
@ -407,11 +407,8 @@ namespace ts {
|
||||
// directory: /a/b/c/d/e
|
||||
// resolvedFileName: /a/b/foo.d.ts
|
||||
// commonPrefix: /a/b
|
||||
// for failed lookups use the root directory as commonPrefix
|
||||
const commonPrefix = resolvedFileName ? getCommonPrefix(path, resolvedFileName) : path.substr(0, getRootLength(path));
|
||||
if (!commonPrefix) {
|
||||
return;
|
||||
}
|
||||
// for failed lookups cache the result for every directory up to root
|
||||
const commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
||||
let current = path;
|
||||
while (current !== commonPrefix) {
|
||||
const parent = getDirectoryPath(current);
|
||||
|
||||
@ -262,7 +262,7 @@ namespace ts {
|
||||
failedLookupLocations: [],
|
||||
});
|
||||
assert.isDefined(cache.get("c:/foo"));
|
||||
assert.isUndefined(cache.get("c:/"));
|
||||
assert.isDefined(cache.get("c:/"));
|
||||
assert.isUndefined(cache.get("d:/"));
|
||||
|
||||
cache = resolutionCache.getOrCreateCacheForModuleName("f");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user