From 1aad3c627375a17d2423743de8d72e1cadffa17e Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 11 Jun 2018 10:51:11 -0700 Subject: [PATCH] addClassStaticThisReferences: Don't cross class boundary (#24860) --- src/services/findAllReferences.ts | 2 +- .../fourslash/findAllRefsClassWithStaticThisAccess.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index e40a1f28161..46dd83851c1 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1040,7 +1040,7 @@ namespace ts.FindAllReferences.Core { if (node.kind === SyntaxKind.ThisKeyword) { addRef(node); } - else if (!isFunctionLike(node)) { + else if (!isFunctionLike(node) && !isClassLike(node)) { node.forEachChild(cb); } }); diff --git a/tests/cases/fourslash/findAllRefsClassWithStaticThisAccess.ts b/tests/cases/fourslash/findAllRefsClassWithStaticThisAccess.ts index 4802ca40448..f2c432abc76 100644 --- a/tests/cases/fourslash/findAllRefsClassWithStaticThisAccess.ts +++ b/tests/cases/fourslash/findAllRefsClassWithStaticThisAccess.ts @@ -4,7 +4,12 @@ //// static s() { //// [|this|]; //// } -//// static get f() { return [|this|]; } +//// static get f() { +//// return [|this|]; +//// +//// function inner() { this; } +//// class Inner { x = this; } +//// } ////} const [r0, r1, r2] = test.ranges();