File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -2792,6 +2792,10 @@ namespace ts {
2792
2792
return isRightSideOfPropertyAccess ( node ) ? node . parent : node ;
2793
2793
}
2794
2794
2795
+ function climbPastManyPropertyAccesses ( node : Node ) : Node {
2796
+ return isRightSideOfPropertyAccess ( node ) ? climbPastManyPropertyAccesses ( node . parent ) : node ;
2797
+ }
2798
+
2795
2799
function isCallExpressionTarget ( node : Node ) : boolean {
2796
2800
node = climbPastPropertyAccess ( node ) ;
2797
2801
return node && node . parent && node . parent . kind === SyntaxKind . CallExpression && ( < CallExpression > node . parent ) . expression === node ;
@@ -2804,7 +2808,7 @@ namespace ts {
2804
2808
2805
2809
/** Returns a CallLikeExpression where `node` is the target being invoked. */
2806
2810
function getAncestorCallLikeExpression ( node : Node ) : CallLikeExpression | undefined {
2807
- const target = climbPastPropertyAccess ( node ) ;
2811
+ const target = climbPastManyPropertyAccesses ( node ) ;
2808
2812
const callLike = target . parent ;
2809
2813
return isCallLikeExpression ( callLike ) && getInvokedExpression ( callLike ) === target && callLike ;
2810
2814
}
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