Skip to content

Commit 73a9447

Browse files
author
Andy Hanson
committed
Remove checks for symbol.declarations
1 parent eb9d4c0 commit 73a9447

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

src/services/findAllReferences.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ namespace ts.FindAllReferences {
108108
switch (def.type) {
109109
case "symbol": {
110110
const { symbol, node } = def;
111-
const declarations = symbol.declarations;
112-
if (!declarations || declarations.length === 0) {
113-
return undefined;
114-
}
115111
const { displayParts, kind } = getDefinitionKindAndDisplayParts(symbol, node, checker);
116112
const name = displayParts.map(p => p.text).join("");
117113
return { node, name, kind, displayParts };
@@ -273,7 +269,7 @@ namespace ts.FindAllReferences.Core {
273269
}
274270
}
275271

276-
let symbol = checker.getSymbolAtLocation(node);
272+
const symbol = checker.getSymbolAtLocation(node);
277273

278274
// Could not find a symbol e.g. unknown identifier
279275
if (!symbol) {
@@ -285,14 +281,6 @@ namespace ts.FindAllReferences.Core {
285281
return undefined;
286282
}
287283

288-
// If this property is derived from another one, find references on the original property instead.
289-
symbol = (symbol as ts.SymbolLinks).syntheticOrigin || symbol;
290-
291-
// The symbol was an internal symbol and does not have a declaration e.g. undefined symbol
292-
if (!symbol.declarations || !symbol.declarations.length) {
293-
return undefined;
294-
}
295-
296284
return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, checker, cancellationToken, options);
297285
}
298286

tests/cases/fourslash/findAllRefsMappedType.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77
////declare const u: U;
88
////u.[|a|];
99

10-
verify.singleReferenceGroup("(property) T.a: number");
10+
const ranges = test.ranges();
11+
const [r0, r1, r2] = ranges;
12+
verify.referenceGroups([r0, r1], [{ definition: "(property) T.a: number", ranges }]);
13+
verify.referenceGroups(r2, [
14+
{ definition: "(property) T.a: number", ranges: [r0, r1] },
15+
{ definition: "(property) a: string", ranges: [r2] }]);

0 commit comments

Comments
 (0)