MCPcopy Create free account
hub / github.com/nodejs/node / collectLinkedAliases

Function collectLinkedAliases

test/fixtures/snapshot/typescript.js:55574–55613  ·  view source on GitHub ↗
(node, setVisibility)

Source from the content-addressed store, hash-verified

55572 }
55573 }
55574 function collectLinkedAliases(node, setVisibility) {
55575 var exportSymbol;
55576 if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) {
55577 exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
55578 }
55579 else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) {
55580 exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */);
55581 }
55582 var result;
55583 var visited;
55584 if (exportSymbol) {
55585 visited = new ts.Set();
55586 visited.add(getSymbolId(exportSymbol));
55587 buildVisibleNodeList(exportSymbol.declarations);
55588 }
55589 return result;
55590 function buildVisibleNodeList(declarations) {
55591 ts.forEach(declarations, function (declaration) {
55592 var resultNode = getAnyImportSyntax(declaration) || declaration;
55593 if (setVisibility) {
55594 getNodeLinks(declaration).isVisible = true;
55595 }
55596 else {
55597 result = result || [];
55598 ts.pushIfUnique(result, resultNode);
55599 }
55600 if (ts.isInternalModuleImportEqualsDeclaration(declaration)) {
55601 // Add the referenced top container visible
55602 var internalModuleReference = declaration.moduleReference;
55603 var firstIdentifier = ts.getFirstIdentifier(internalModuleReference);
55604 var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, undefined, undefined, /*isUse*/ false);
55605 if (importSymbol && visited) {
55606 if (ts.tryAddToSet(visited, getSymbolId(importSymbol))) {
55607 buildVisibleNodeList(importSymbol.declarations);
55608 }
55609 }
55610 }
55611 });
55612 }
55613 }
55614 /**
55615 * Push an entry on the type resolution stack. If an entry with the given target and the given property name
55616 * is already on the stack, and no entries in between already have a type, then a circularity has occurred.

Callers 2

checkExportSpecifierFunction · 0.85
checkExportAssignmentFunction · 0.85

Calls 6

resolveNameFunction · 0.85
getSymbolIdFunction · 0.85
buildVisibleNodeListFunction · 0.85
forEachChildMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected