fix(37877): include in NavigationBar default exported child items (#38255)

This commit is contained in:
Alexander T 2020-05-12 17:26:31 +03:00 committed by GitHub
parent f4872eb493
commit 5895493815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 1 deletions

View File

@ -307,7 +307,18 @@ namespace ts.NavigationBar {
addNodeWithRecursiveChild(node, getInteriorModule(<ModuleDeclaration>node).body);
break;
case SyntaxKind.ExportAssignment:
case SyntaxKind.ExportAssignment: {
const expression = (<ExportAssignment>node).expression;
if (isObjectLiteralExpression(expression)) {
startNode(node);
addChildrenRecursively(expression);
endNode();
}
else {
addLeafNode(node);
}
break;
}
case SyntaxKind.ExportSpecifier:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.IndexSignature:

View File

@ -5,6 +5,13 @@
//// export default () => ""
//// export default abc;
//// export default class AB {}
//// export default {
//// a: 1,
//// b: 1,
//// c: {
//// d: 1
//// }
//// }
verify.navigationTree({
"text": '"navigationItemsExportDefaultExpression"',
@ -20,6 +27,31 @@ verify.navigationTree({
"kind": "function",
"kindModifiers": "export"
},
{
"text": "default",
"kind": "const",
"kindModifiers": "export",
"childItems": [
{
"text": "a",
"kind": "property"
},
{
"text": "b",
"kind": "property"
},
{
"text": "c",
"kind": "property",
"childItems": [
{
"text": "d",
"kind": "property"
}
]
}
]
},
{
"text": "AB",
"kind": "class",

View File

@ -6,6 +6,13 @@
//// export = function () {}
//// export = () => ""
//// export = class AB {}
//// export = {
//// a: 1,
//// b: 1,
//// c: {
//// d: 1
//// }
//// }
verify.navigationTree({
"text": '"navigationItemsExportEqualsExpression"',
@ -26,6 +33,31 @@ verify.navigationTree({
"kind": "class",
"kindModifiers": "export"
},
{
"text": "export=",
"kind": "const",
"kindModifiers": "export",
"childItems": [
{
"text": "a",
"kind": "property"
},
{
"text": "b",
"kind": "property"
},
{
"text": "c",
"kind": "property",
"childItems": [
{
"text": "d",
"kind": "property"
}
]
}
]
},
{
"text": "abc",
"kind": "const"