Skip to content

Commit 7a0ee3c

Browse files
author
Andy
authored
Merge pull request #15535 from Microsoft/getTargetOfExportSpecifier
Re-use code from 'getTargetOfExportSpecifier'
2 parents 1db4f96 + 04c8948 commit 7a0ee3c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,10 +1400,10 @@ namespace ts {
14001400
return resolveExternalModuleSymbol(node.parent.symbol, dontResolveAlias);
14011401
}
14021402

1403-
function getTargetOfExportSpecifier(node: ExportSpecifier, dontResolveAlias?: boolean): Symbol {
1404-
return (<ExportDeclaration>node.parent.parent).moduleSpecifier ?
1405-
getExternalModuleMember(<ExportDeclaration>node.parent.parent, node, dontResolveAlias) :
1406-
resolveEntityName(node.propertyName || node.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, /*ignoreErrors*/ false, dontResolveAlias);
1403+
function getTargetOfExportSpecifier(node: ExportSpecifier, meaning: SymbolFlags, dontResolveAlias?: boolean) {
1404+
return node.parent.parent.moduleSpecifier ?
1405+
getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
1406+
resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias);
14071407
}
14081408

14091409
function getTargetOfExportAssignment(node: ExportAssignment, dontResolveAlias: boolean): Symbol {
@@ -1421,7 +1421,7 @@ namespace ts {
14211421
case SyntaxKind.ImportSpecifier:
14221422
return getTargetOfImportSpecifier(<ImportSpecifier>node, dontRecursivelyResolve);
14231423
case SyntaxKind.ExportSpecifier:
1424-
return getTargetOfExportSpecifier(<ExportSpecifier>node, dontRecursivelyResolve);
1424+
return getTargetOfExportSpecifier(<ExportSpecifier>node, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, dontRecursivelyResolve);
14251425
case SyntaxKind.ExportAssignment:
14261426
return getTargetOfExportAssignment(<ExportAssignment>node, dontRecursivelyResolve);
14271427
case SyntaxKind.NamespaceExportDeclaration:
@@ -3721,10 +3721,7 @@ namespace ts {
37213721
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, Diagnostics.Cannot_find_name_0, node);
37223722
}
37233723
else if (node.parent.kind === SyntaxKind.ExportSpecifier) {
3724-
const exportSpecifier = <ExportSpecifier>node.parent;
3725-
exportSymbol = (<ExportDeclaration>exportSpecifier.parent.parent).moduleSpecifier ?
3726-
getExternalModuleMember(<ExportDeclaration>exportSpecifier.parent.parent, exportSpecifier) :
3727-
resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
3724+
exportSymbol = getTargetOfExportSpecifier(<ExportSpecifier>node.parent, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
37283725
}
37293726
const result: Node[] = [];
37303727
if (exportSymbol) {

0 commit comments

Comments
 (0)