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

Function getSymbolForExpression

test/fixtures/snapshot/typescript.js:72637–72653  ·  view source on GitHub ↗

* Try to find a resolved symbol for an expression without also resolving its type, as * getSymbolAtLocation would (as that could be reentrant into contextual typing)

(e)

Source from the content-addressed store, hash-verified

72635 * getSymbolAtLocation would (as that could be reentrant into contextual typing)
72636 */
72637 function getSymbolForExpression(e) {
72638 if (e.symbol) {
72639 return e.symbol;
72640 }
72641 if (ts.isIdentifier(e)) {
72642 return getResolvedSymbol(e);
72643 }
72644 if (ts.isPropertyAccessExpression(e)) {
72645 var lhsType = getTypeOfExpression(e.expression);
72646 return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
72647 }
72648 return undefined;
72649 function tryGetPrivateIdentifierPropertyOfType(type, id) {
72650 var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
72651 return lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(type, lexicallyScopedSymbol);
72652 }
72653 }
72654 // In an assignment expression, the right operand is contextually typed by the type of the left operand.
72655 // Don't do this for assignment declarations unless there is a type tag on the assignment, to avoid circularity from checking the right operand.
72656 function getContextualTypeForAssignmentDeclaration(binaryExpression) {

Calls 4

getResolvedSymbolFunction · 0.85
getTypeOfExpressionFunction · 0.85
getPropertyOfTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…