Skip to content

Commit 6602fbf

Browse files
committed
include in find-all-references results
Signed-off-by: Ashley Claymore <[email protected]>
1 parent e9b1fa3 commit 6602fbf

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/compiler/checker.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30734,6 +30734,7 @@ namespace ts {
3073430734
}
3073530735

3073630736
markPropertyAsReferenced(lexicallyScopedSymbol, /* nodeForCheckWriteOnly: */ undefined, /* isThisAccess: */ false);
30737+
getNodeLinks(node).resolvedSymbol = lexicallyScopedSymbol;
3073730738

3073830739
const exp = node.expression;
3073930740
let rightType = checkExpression(exp, checkMode);
@@ -38203,6 +38204,15 @@ namespace ts {
3820338204
return resolveEntityName(<Identifier>name, /*meaning*/ SymbolFlags.FunctionScopedVariable);
3820438205
}
3820538206

38207+
if (isPrivateIdentifier(name) && isPrivateIdentifierInInExpression(name.parent)) {
38208+
const links = getNodeLinks(name.parent);
38209+
if (links.resolvedSymbol) {
38210+
return links.resolvedSymbol;
38211+
}
38212+
checkPrivateIdentifierInInExpression(name.parent);
38213+
return links.resolvedSymbol;
38214+
}
38215+
3820638216
// Do we want to return undefined here?
3820738217
return undefined;
3820838218
}

tests/cases/fourslash/findAllRefsPrivateNameProperties.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//// [|[|{|"isDefinition": true, "isWriteAccess": true, "contextRangeIndex": 0 |}#foo|] = 10;|]
55
//// constructor() {
66
//// this.[|{|"isWriteAccess": true|}#foo|] = 20;
7+
//// [|#foo|] in this;
78
//// }
89
////}
910
////class D extends C {
@@ -13,12 +14,12 @@
1314
//// }
1415
////}
1516
////class E {
16-
//// [|[|{|"isDefinition": true, "contextRangeIndex": 3 |}#foo|]: number;|]
17+
//// [|[|{|"isDefinition": true, "contextRangeIndex": 4 |}#foo|]: number;|]
1718
//// constructor() {
1819
//// this.[|{|"isWriteAccess": true|}#foo|] = 20;
1920
//// }
2021
////}
2122

22-
const [rC0Def, rC0, rC1, rE0Def, rE0, rE1] = test.ranges();
23-
verify.singleReferenceGroup("(property) C.#foo: number", [rC0, rC1]);
23+
const [rC0Def, rC0, rC1, rC2, rE0Def, rE0, rE1] = test.ranges();
24+
verify.singleReferenceGroup("(property) C.#foo: number", [rC0, rC1, rC2]);
2425
verify.singleReferenceGroup("(property) E.#foo: number", [rE0, rE1]);

0 commit comments

Comments
 (0)