mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Merge pull request #9897 from Microsoft/umd_export
Clarify code checking for UMD exports...
This commit is contained in:
commit
f00d3fcede
@ -18449,7 +18449,7 @@ namespace ts {
|
||||
|
||||
// When resolved as an expression identifier, if the given node references an exported entity, return the declaration
|
||||
// node of the exported entity's container. Otherwise, return undefined.
|
||||
function getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration {
|
||||
function getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration | undefined {
|
||||
node = getParseTreeNode(node, isIdentifier);
|
||||
if (node) {
|
||||
// When resolving the export container for the name of a module or enum
|
||||
@ -18471,10 +18471,11 @@ namespace ts {
|
||||
const parentSymbol = getParentOfSymbol(symbol);
|
||||
if (parentSymbol) {
|
||||
if (parentSymbol.flags & SymbolFlags.ValueModule && parentSymbol.valueDeclaration.kind === SyntaxKind.SourceFile) {
|
||||
const symbolFile = <SourceFile>parentSymbol.valueDeclaration;
|
||||
const referenceFile = getSourceFileOfNode(node);
|
||||
// If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined.
|
||||
if (parentSymbol.valueDeclaration === getSourceFileOfNode(node)) {
|
||||
return <SourceFile>parentSymbol.valueDeclaration;
|
||||
}
|
||||
const symbolIsUmdExport = symbolFile !== referenceFile;
|
||||
return symbolIsUmdExport ? undefined : symbolFile;
|
||||
}
|
||||
for (let n = node.parent; n; n = n.parent) {
|
||||
if (isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) {
|
||||
@ -18484,8 +18485,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// When resolved as an expression identifier, if the given node references an import, return the declaration of
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user