mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix(38785): include in NavigationBar child items from default exported functions (#38915)
This commit is contained in:
@@ -310,9 +310,11 @@ namespace ts.NavigationBar {
|
||||
|
||||
case SyntaxKind.ExportAssignment: {
|
||||
const expression = (<ExportAssignment>node).expression;
|
||||
if (isObjectLiteralExpression(expression)) {
|
||||
const child = isObjectLiteralExpression(expression) ? expression :
|
||||
isArrowFunction(expression) || isFunctionExpression(expression) ? expression.body : undefined;
|
||||
if (child) {
|
||||
startNode(node);
|
||||
addChildrenRecursively(expression);
|
||||
addChildrenRecursively(child);
|
||||
endNode();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,8 +1,24 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
//// const abc = 12;
|
||||
//// export default function () {}
|
||||
//// export default function () {
|
||||
//// return class Foo {
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// export default () => ""
|
||||
//// export default () => {
|
||||
//// return class Foo {
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// export default function f1() {}
|
||||
//// export default function f2() {
|
||||
//// return class Foo {
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// const abc = 12;
|
||||
//// export default abc;
|
||||
//// export default class AB {}
|
||||
//// export default {
|
||||
@@ -22,11 +38,33 @@ verify.navigationTree({
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "default",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "Foo",
|
||||
"kind": "class"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "default",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "default",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "Foo",
|
||||
"kind": "class"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "default",
|
||||
"kind": "const",
|
||||
@@ -65,6 +103,22 @@ verify.navigationTree({
|
||||
"text": "default",
|
||||
"kind": "const",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "f1",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "f2",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "Foo",
|
||||
"kind": "class"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
// 35477
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
//// export = function () {}
|
||||
//// export = function () {
|
||||
//// return class Foo {
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// export = () => ""
|
||||
//// export = () => {
|
||||
//// return class Foo {
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// export = function f1() {}
|
||||
//// export = function f2() {
|
||||
//// return class Foo {
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// const abc = 12;
|
||||
//// export = abc;
|
||||
//// export = function () {}
|
||||
//// export = () => ""
|
||||
//// export = class AB {}
|
||||
//// export = {
|
||||
//// a: 1,
|
||||
@@ -23,11 +39,49 @@ verify.navigationTree({
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "export=",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "Foo",
|
||||
"kind": "class"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "export=",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "export=",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "Foo",
|
||||
"kind": "class"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "export=",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export"
|
||||
},
|
||||
{
|
||||
"text": "export=",
|
||||
"kind": "function",
|
||||
"kindModifiers": "export",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "Foo",
|
||||
"kind": "class"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "export=",
|
||||
"kind": "class",
|
||||
|
||||
Reference in New Issue
Block a user