* 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)
| 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) { |
no test coverage detected
searching dependent graphs…