From f3e2e891da9a50cafd1f10b64872c7d919c223ee Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 20 Jun 2018 12:57:34 -0700 Subject: [PATCH] navigationBar: Avoid double recursion on special property assignment (#25077) --- src/services/navigationBar.ts | 2 +- .../fourslash/navbarNestedCommonJsExports.ts | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/navbarNestedCommonJsExports.ts diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index f381be9b7d1..d97004b80c5 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -277,7 +277,7 @@ namespace ts.NavigationBar { case SpecialPropertyAssignmentKind.PrototypeProperty: case SpecialPropertyAssignmentKind.Prototype: addNodeWithRecursiveChild(node, (node as BinaryExpression).right); - break; + return; case SpecialPropertyAssignmentKind.ThisProperty: case SpecialPropertyAssignmentKind.Property: case SpecialPropertyAssignmentKind.None: diff --git a/tests/cases/fourslash/navbarNestedCommonJsExports.ts b/tests/cases/fourslash/navbarNestedCommonJsExports.ts new file mode 100644 index 00000000000..3c2d4499172 --- /dev/null +++ b/tests/cases/fourslash/navbarNestedCommonJsExports.ts @@ -0,0 +1,35 @@ +/// + +// @allowJs: true + +// @Filename: /a.js +////exports.a = exports.b = exports.c = 0; + +verify.navigationTree({ + text: "", + kind: "script", + childItems: [ + { + text: "a", + kind: "const", + childItems: [ + { + text: "b", + kind: "const", + childItems: [{ text: "c", kind: "const" }], + }, + ], + }, + ], +}); + +verify.navigationBar([ + { + text: "", + kind: "script", + childItems: [ + { text: "a", kind: "const" }, + ], + }, +]); +