mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Fix bug: In findAllReferences, don't crash on static method missing body (#24814)
This commit is contained in:
parent
3f8661b2de
commit
986532d36b
@ -1035,14 +1035,16 @@ namespace ts.FindAllReferences.Core {
|
||||
if (!(isMethodOrAccessor(member) && hasModifier(member, ModifierFlags.Static))) {
|
||||
continue;
|
||||
}
|
||||
member.body!.forEachChild(function cb(node) {
|
||||
if (node.kind === SyntaxKind.ThisKeyword) {
|
||||
addRef(node);
|
||||
}
|
||||
else if (!isFunctionLike(node)) {
|
||||
node.forEachChild(cb);
|
||||
}
|
||||
});
|
||||
if (member.body) {
|
||||
member.body.forEachChild(function cb(node) {
|
||||
if (node.kind === SyntaxKind.ThisKeyword) {
|
||||
addRef(node);
|
||||
}
|
||||
else if (!isFunctionLike(node)) {
|
||||
node.forEachChild(cb);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
7
tests/cases/fourslash/findAllRefsDeclareClass.ts
Normal file
7
tests/cases/fourslash/findAllRefsDeclareClass.ts
Normal file
@ -0,0 +1,7 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////declare class [|{| "isWriteAccess": true, "isDefinition": true |}C|] {
|
||||
//// static m(): void;
|
||||
////}
|
||||
|
||||
verify.singleReferenceGroup("class C");
|
||||
Loading…
x
Reference in New Issue
Block a user