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

Function getReferenceForShorthandProperty

test/fixtures/snapshot/typescript.js:138305–138319  ·  view source on GitHub ↗
(_a, search, state)

Source from the content-addressed store, hash-verified

138303 }
138304 }
138305 function getReferenceForShorthandProperty(_a, search, state) {
138306 var flags = _a.flags, valueDeclaration = _a.valueDeclaration;
138307 var shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration);
138308 var name = valueDeclaration && ts.getNameOfDeclaration(valueDeclaration);
138309 /*
138310 * Because in short-hand property assignment, an identifier which stored as name of the short-hand property assignment
138311 * has two meanings: property name and property value. Therefore when we do findAllReference at the position where
138312 * an identifier is declared, the language service should return the position of the variable declaration as well as
138313 * the position in short-hand property assignment excluding property accessing. However, if we do findAllReference at the
138314 * position of property accessing, the referenceEntry of such position will be handled in the first case.
138315 */
138316 if (!(flags & 33554432 /* SymbolFlags.Transient */) && name && search.includes(shorthandValueSymbol)) {
138317 addReference(name, shorthandValueSymbol, state);
138318 }
138319 }
138320 function addReference(referenceLocation, relatedSymbol, state) {
138321 var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator
138322 // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference

Callers 1

getReferencesAtLocationFunction · 0.85

Calls 2

addReferenceFunction · 0.85
includesMethod · 0.80

Tested by

no test coverage detected