From bff8caa54cd9cc944eabbc213946a8a06e4f455b Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 27 Aug 2015 13:15:03 -0700 Subject: [PATCH 1/2] Add class expression if existed to classifiable-name map --- src/compiler/binder.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 340bf47820940..16f2a59a58ddd 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -973,6 +973,10 @@ namespace ts { else { let bindingName = node.name ? node.name.text : "__class"; bindAnonymousDeclaration(node, SymbolFlags.Class, bindingName); + // Add name of class expression into the map for semantic classifier + if (node.name) { + classifiableNames[node.name.text] = node.name.text; + } } let symbol = node.symbol; @@ -1062,4 +1066,4 @@ namespace ts { : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); } } -} +} From 4c516264694de09714482c64342f41f0fb1079d9 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 27 Aug 2015 13:16:10 -0700 Subject: [PATCH 2/2] Add tests --- .../semanticClassificationClassExpression.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/cases/fourslash/semanticClassificationClassExpression.ts diff --git a/tests/cases/fourslash/semanticClassificationClassExpression.ts b/tests/cases/fourslash/semanticClassificationClassExpression.ts new file mode 100644 index 0000000000000..f067265df2994 --- /dev/null +++ b/tests/cases/fourslash/semanticClassificationClassExpression.ts @@ -0,0 +1,12 @@ +/// + +//// var x = class /*0*/C {} +//// class /*1*/C {} +//// class /*2*/D extends class /*3*/B{} { } +var c = classification; +verify.semanticClassificationsAre( + c.className("C", test.marker("0").position), + c.className("C", test.marker("1").position), + c.className("D", test.marker("2").position), + c.className("B", test.marker("3").position) +); \ No newline at end of file