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

Function getReferencedSymbolsForSymbol

test/fixtures/snapshot/typescript.js:137629–137649  ·  view source on GitHub ↗

Core find-all-references algorithm for a normal symbol.

(originalSymbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options)

Source from the content-addressed store, hash-verified

137627 }
137628 /** Core find-all-references algorithm for a normal symbol. */
137629 function getReferencedSymbolsForSymbol(originalSymbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options) {
137630 var symbol = node && skipPastExportOrImportSpecifierOrUnion(originalSymbol, node, checker, /*useLocalSymbolForExportSpecifier*/ !isForRenameWithPrefixAndSuffixText(options)) || originalSymbol;
137631 // Compute the meaning from the location and the symbol it references
137632 var searchMeaning = node ? getIntersectingMeaningFromDeclarations(node, symbol) : 7 /* SemanticMeaning.All */;
137633 var result = [];
137634 var state = new State(sourceFiles, sourceFilesSet, node ? getSpecialSearchKind(node) : 0 /* SpecialSearchKind.None */, checker, cancellationToken, searchMeaning, options, result);
137635 var exportSpecifier = !isForRenameWithPrefixAndSuffixText(options) || !symbol.declarations ? undefined : ts.find(symbol.declarations, ts.isExportSpecifier);
137636 if (exportSpecifier) {
137637 // When renaming at an export specifier, rename the export and not the thing being exported.
137638 getReferencesAtExportSpecifier(exportSpecifier.name, symbol, exportSpecifier, state.createSearch(node, originalSymbol, /*comingFrom*/ undefined), state, /*addReferencesHere*/ true, /*alwaysGetReferences*/ true);
137639 }
137640 else if (node && node.kind === 88 /* SyntaxKind.DefaultKeyword */ && symbol.escapedName === "default" /* InternalSymbolName.Default */ && symbol.parent) {
137641 addReference(node, symbol, state);
137642 searchForImportsOfExport(node, symbol, { exportingModuleSymbol: symbol.parent, exportKind: 1 /* ExportKind.Default */ }, state);
137643 }
137644 else {
137645 var search = state.createSearch(node, symbol, /*comingFrom*/ undefined, { allSearchSymbols: node ? populateSearchSymbolSet(symbol, node, checker, options.use === 2 /* FindReferencesUse.Rename */, !!options.providePrefixAndSuffixTextForRename, !!options.implementations) : [symbol] });
137646 getReferencesInContainerOrFiles(symbol, state, search);
137647 }
137648 return result;
137649 }
137650 function getReferencesInContainerOrFiles(symbol, state, search) {
137651 // Try to get the smallest valid scope that we can limit our search to;
137652 // otherwise we'll need to search globally (i.e. include each file).

Tested by

no test coverage detected