mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 00:55:01 -06:00
fix(59825): getNavigationTree crash on invalid class merge and function merge with expando members (#60152)
This commit is contained in:
parent
20f67d791c
commit
009b3ffdda
@ -760,6 +760,7 @@ function isSynthesized(node: Node) {
|
||||
// We want to merge own children like `I` in in `module A { interface I {} } module A { interface I {} }`
|
||||
// We don't want to merge unrelated children like `m` in `const o = { a: { m() {} }, b: { m() {} } };`
|
||||
function isOwnChild(n: Node, parent: NavigationBarNode): boolean {
|
||||
if (n.parent === undefined) return false;
|
||||
const par = isModuleBlock(n.parent) ? n.parent.parent : n.parent;
|
||||
return par === parent.node || contains(parent.additionalNodes, par);
|
||||
}
|
||||
|
||||
31
tests/cases/fourslash/navigationBarItemsClass6.ts
Normal file
31
tests/cases/fourslash/navigationBarItemsClass6.ts
Normal file
@ -0,0 +1,31 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////function Z() { }
|
||||
////
|
||||
////Z.foo = 42
|
||||
////
|
||||
////class Z { }
|
||||
|
||||
verify.navigationTree({
|
||||
text: "<global>",
|
||||
kind: "script",
|
||||
childItems: [
|
||||
{
|
||||
text: "Z",
|
||||
kind: "class",
|
||||
childItems: [
|
||||
{
|
||||
text: "constructor",
|
||||
kind: "constructor"
|
||||
},
|
||||
{
|
||||
text: "foo"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: "Z",
|
||||
kind: "class"
|
||||
}
|
||||
]
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user