MCPcopy Index your code
hub / github.com/nodejs/node / getReferencesForStringLiteral

Function getReferencesForStringLiteral

test/fixtures/snapshot/typescript.js:138650–138673  ·  view source on GitHub ↗
(node, sourceFiles, checker, cancellationToken)

Source from the content-addressed store, hash-verified

138648 }];
138649 }
138650 function getReferencesForStringLiteral(node, sourceFiles, checker, cancellationToken) {
138651 var type = ts.getContextualTypeFromParentOrAncestorTypeNode(node, checker);
138652 var references = ts.flatMap(sourceFiles, function (sourceFile) {
138653 cancellationToken.throwIfCancellationRequested();
138654 return ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, node.text), function (ref) {
138655 if (ts.isStringLiteralLike(ref) && ref.text === node.text) {
138656 if (type) {
138657 var refType = ts.getContextualTypeFromParentOrAncestorTypeNode(ref, checker);
138658 if (type !== checker.getStringType() && type === refType) {
138659 return nodeEntry(ref, 2 /* EntryKind.StringLiteral */);
138660 }
138661 }
138662 else {
138663 return ts.isNoSubstitutionTemplateLiteral(ref) && !ts.rangeIsOnSingleLine(ref, sourceFile) ? undefined :
138664 nodeEntry(ref, 2 /* EntryKind.StringLiteral */);
138665 }
138666 }
138667 });
138668 });
138669 return [{
138670 definition: { type: 4 /* DefinitionKind.String */, node: node },
138671 references: references
138672 }];
138673 }
138674 // For certain symbol kinds, we need to include other symbols in the search set.
138675 // This is not needed when searching for re-exports.
138676 function populateSearchSymbolSet(symbol, location, checker, isForRename, providePrefixAndSuffixText, implementations) {

Callers 1

Calls 3

nodeEntryFunction · 0.85
flatMapMethod · 0.80

Tested by

no test coverage detected