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

Function shouldAddSingleReference

test/fixtures/snapshot/typescript.js:137872–137882  ·  view source on GitHub ↗
(singleRef, state)

Source from the content-addressed store, hash-verified

137870 }
137871 Core.eachExportReference = eachExportReference;
137872 function shouldAddSingleReference(singleRef, state) {
137873 if (!hasMatchingMeaning(singleRef, state))
137874 return false;
137875 if (state.options.use !== 2 /* FindReferencesUse.Rename */)
137876 return true;
137877 // Don't rename an import type `import("./module-name")` when renaming `name` in `export = name;`
137878 if (!ts.isIdentifier(singleRef))
137879 return false;
137880 // At `default` in `import { default as x }` or `export { default as x }`, do add a reference, but do not rename.
137881 return !(ts.isImportOrExportSpecifier(singleRef.parent) && singleRef.escapedText === "default" /* InternalSymbolName.Default */);
137882 }
137883 // Go to the symbol we imported from and find references for it.
137884 function searchForImportedSymbol(symbol, state) {
137885 if (!symbol.declarations)

Callers 1

searchForImportsOfExportFunction · 0.85

Calls 1

hasMatchingMeaningFunction · 0.85

Tested by

no test coverage detected