From 6f4deaea7893880d2eef2029d43e6796b1551fdf Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 8 May 2020 17:34:41 +0800 Subject: [PATCH] Fix tranced es5 classes after new scope --- src/services/navigationBar.ts | 1 + .../navigationBarWithLocalVariables.ts | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/cases/fourslash/navigationBarWithLocalVariables.ts diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 38faf25da7..3ddc4db1c7 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -163,6 +163,7 @@ namespace ts.NavigationBar { // Save the old parent parentsStack.push(parent); trackedEs5ClassesStack.push(trackedEs5Classes); + trackedEs5Classes = undefined; parent = navNode; } diff --git a/tests/cases/fourslash/navigationBarWithLocalVariables.ts b/tests/cases/fourslash/navigationBarWithLocalVariables.ts new file mode 100644 index 0000000000..de673d6d9d --- /dev/null +++ b/tests/cases/fourslash/navigationBarWithLocalVariables.ts @@ -0,0 +1,23 @@ +/// + +//// function x(){ +//// const x = Object() +//// x.foo = "" +//// } + +verify.navigationTree({ + "text": "", + "kind": "script", + "childItems": [ + { + "text": "x", + "kind": "function", + "childItems": [ + { + "text": "x", + "kind": "const" + } + ] + } + ] +});