Inline symbolHasBeenSeen

This commit is contained in:
Andrew Branch committed 2019-07-29 10:21:33 -07:00
1 parent af96ac4994
commit c3437d13ae
1 file changed
+4 -8
+4 -8
View File
@@ -1358,9 +1358,10 @@ namespace ts.Completions {
// If `!!d.parent.parent.moduleSpecifier`, this is `export { foo } from "foo"` re-export, which creates a new symbol (thus isn't caught by the first check).
if (some(symbol.declarations, d => isExportSpecifier(d) && !d.propertyName && !!d.parent.parent.moduleSpecifier)) {
// Walk the export chain back one module (step 1 or 2 in diagrammed example)
const nearestExportSymbol = Debug.assertDefined(getNearestExportSymbol(symbol));
if (!symbolHasBeenSeen(nearestExportSymbol)) {
aliasesToReturnIfOriginalsAreMissing.set(getSymbolId(nearestExportSymbol).toString(), { alias: symbol, moduleSymbol, insertAt: symbols.length });
const nearestExportSymbolId = getSymbolId(Debug.assertDefined(getNearestExportSymbol(symbol)));
const symbolHasBeenSeen = !!symbolToOriginInfoMap[nearestExportSymbolId] || aliasesToAlreadyIncludedSymbols.has(nearestExportSymbolId.toString());
if (!symbolHasBeenSeen) {
aliasesToReturnIfOriginalsAreMissing.set(nearestExportSymbolId.toString(), { alias: symbol, moduleSymbol, insertAt: symbols.length });
aliasesToAlreadyIncludedSymbols.set(getSymbolId(symbol).toString(), true);
}
else {
@@ -1393,11 +1394,6 @@ namespace ts.Completions {
symbolToOriginInfoMap[getSymbolId(symbol)] = origin;
}
}
function symbolHasBeenSeen(symbol: Symbol) {
const symbolId = getSymbolId(symbol);
return !!symbolToOriginInfoMap[symbolId] || aliasesToAlreadyIncludedSymbols.has(symbolId.toString());
}
}
function getNearestExportSymbol(fromSymbol: Symbol) {