File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2792,6 +2792,10 @@ namespace ts {
27922792 return isRightSideOfPropertyAccess ( node ) ? node . parent : node ;
27932793 }
27942794
2795+ function climbPastManyPropertyAccesses ( node : Node ) : Node {
2796+ return isRightSideOfPropertyAccess ( node ) ? climbPastManyPropertyAccesses ( node . parent ) : node ;
2797+ }
2798+
27952799 function isCallExpressionTarget ( node : Node ) : boolean {
27962800 node = climbPastPropertyAccess ( node ) ;
27972801 return node && node . parent && node . parent . kind === SyntaxKind . CallExpression && ( < CallExpression > node . parent ) . expression === node ;
@@ -2804,7 +2808,7 @@ namespace ts {
28042808
28052809 /** Returns a CallLikeExpression where `node` is the target being invoked. */
28062810 function getAncestorCallLikeExpression ( node : Node ) : CallLikeExpression | undefined {
2807- const target = climbPastPropertyAccess ( node ) ;
2811+ const target = climbPastManyPropertyAccesses ( node ) ;
28082812 const callLike = target . parent ;
28092813 return isCallLikeExpression ( callLike ) && getInvokedExpression ( callLike ) === target && callLike ;
28102814 }
Original file line number Diff line number Diff line change 1+ /// <reference path='fourslash.ts' />
2+
3+ // Test that we can climb past more than one property access to reach a call expression.
4+
5+ ////namespace A {
6+ //// export namespace B {
7+ //// export function f(value: number): void;
8+ //// /*1*/export function f(value: string): void;
9+ //// export function f(value: number | string) {}
10+ //// }
11+ //// }
12+ ////A.B./*2*/f("");
13+
14+ goTo . marker ( "2" ) ;
15+ goTo . definition ( ) ;
16+ verify . caretAtMarker ( "1" ) ;
You can’t perform that action at this time.
0 commit comments