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

Function isValidReferencePosition

test/fixtures/snapshot/typescript.js:138093–138116  ·  view source on GitHub ↗
(node, searchSymbolName)

Source from the content-addressed store, hash-verified

138091 return [{ definition: { type: 1 /* DefinitionKind.Label */, node: targetLabel }, references: references }];
138092 }
138093 function isValidReferencePosition(node, searchSymbolName) {
138094 // Compare the length so we filter out strict superstrings of the symbol we are looking for
138095 switch (node.kind) {
138096 case 80 /* SyntaxKind.PrivateIdentifier */:
138097 if (ts.isJSDocMemberName(node.parent)) {
138098 return true;
138099 }
138100 // falls through I guess
138101 case 79 /* SyntaxKind.Identifier */:
138102 return node.text.length === searchSymbolName.length;
138103 case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */:
138104 case 10 /* SyntaxKind.StringLiteral */: {
138105 var str = node;
138106 return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || (ts.isCallExpression(node.parent) && ts.isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node)) &&
138107 str.text.length === searchSymbolName.length;
138108 }
138109 case 8 /* SyntaxKind.NumericLiteral */:
138110 return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
138111 case 88 /* SyntaxKind.DefaultKeyword */:
138112 return "default".length === searchSymbolName.length;
138113 default:
138114 return false;
138115 }
138116 }
138117 function getAllReferencesForImportMeta(sourceFiles, cancellationToken) {
138118 var references = ts.flatMap(sourceFiles, function (sourceFile) {
138119 cancellationToken.throwIfCancellationRequested();

Callers 1

getReferencesAtLocationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected