Skip to content

Commit 8c8eaaa

Browse files
committed
Check for class expressions when finding related symbols in base types
1 parent 81ebab4 commit 8c8eaaa

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/services/services.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@ namespace ts {
18881888

18891889
options.isolatedModules = true;
18901890

1891-
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
1891+
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
18921892
options.suppressOutputPathCheck = true;
18931893

18941894
// Filename can be non-ts file.
@@ -5672,7 +5672,7 @@ namespace ts {
56725672
declaration => (declaration.kind === SyntaxKind.ImportSpecifier ||
56735673
declaration.kind === SyntaxKind.ExportSpecifier) ? declaration : undefined);
56745674
if (importOrExportSpecifier &&
5675-
// export { a }
5675+
// export { a }
56765676
(!importOrExportSpecifier.propertyName ||
56775677
// export {a as class } where a is location
56785678
importOrExportSpecifier.propertyName === location)) {
@@ -5752,7 +5752,7 @@ namespace ts {
57525752
return undefined;
57535753
}
57545754

5755-
// If symbol is of object binding pattern element without property name we would want to
5755+
// If symbol is of object binding pattern element without property name we would want to
57565756
// look for property too and that could be anywhere
57575757
if (isObjectBindingPatternElementWithoutPropertyName(symbol)) {
57585758
return undefined;
@@ -6213,7 +6213,7 @@ namespace ts {
62136213
result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(<ParameterDeclaration>symbol.valueDeclaration, symbol.name));
62146214
}
62156215

6216-
// If this is symbol of binding element without propertyName declaration in Object binding pattern
6216+
// If this is symbol of binding element without propertyName declaration in Object binding pattern
62176217
// Include the property in the search
62186218
const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol);
62196219
if (bindingElementPropertySymbol) {
@@ -6267,7 +6267,7 @@ namespace ts {
62676267

62686268
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
62696269
forEach(symbol.getDeclarations(), declaration => {
6270-
if (declaration.kind === SyntaxKind.ClassDeclaration) {
6270+
if (isClassLike(declaration)) {
62716271
getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(<ClassDeclaration>declaration));
62726272
forEach(getClassImplementsHeritageClauseElements(<ClassDeclaration>declaration), getPropertySymbolFromTypeReference);
62736273
}
@@ -6329,7 +6329,7 @@ namespace ts {
63296329
}
63306330
}
63316331

6332-
// If the reference location is the binding element and doesn't have property name
6332+
// If the reference location is the binding element and doesn't have property name
63336333
// then include the binding element in the related symbols
63346334
// let { a } : { a };
63356335
const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////interface I { [|boom|](): void; }
4+
////new class C implements I {
5+
//// [|boom|](){}
6+
////}
7+
8+
let ranges = test.ranges()
9+
for (let range of ranges) {
10+
goTo.position(range.start);
11+
12+
verify.referencesCountIs(ranges.length);
13+
for (let expectedReference of ranges) {
14+
verify.referencesAtPositionContains(expectedReference);
15+
}
16+
}

0 commit comments

Comments
 (0)