File tree Expand file tree Collapse file tree 5 files changed +57
-8
lines changed
src/compiler/transformers/module Expand file tree Collapse file tree 5 files changed +57
-8
lines changed Original file line number Diff line number Diff line change @@ -802,17 +802,17 @@ namespace ts {
802
802
* Adds a trailing VariableStatement for an enum or module declaration.
803
803
*/
804
804
function addVarForExportedEnumOrNamespaceDeclaration ( statements : Statement [ ] , node : EnumDeclaration | ModuleDeclaration ) {
805
- statements . push (
806
- createVariableStatement (
807
- /*modifiers*/ undefined ,
808
- [ createVariableDeclaration (
809
- getDeclarationName ( node ) ,
805
+ const transformedStatement = createVariableStatement (
806
+ /*modifiers*/ undefined ,
807
+ [ createVariableDeclaration (
808
+ getDeclarationName ( node ) ,
810
809
/*type*/ undefined ,
811
- createPropertyAccess ( createIdentifier ( "exports" ) , getDeclarationName ( node ) )
812
- ) ] ,
810
+ createPropertyAccess ( createIdentifier ( "exports" ) , getDeclarationName ( node ) )
811
+ ) ] ,
813
812
/*location*/ node
814
- )
815
813
) ;
814
+ setNodeEmitFlags ( transformedStatement , NodeEmitFlags . NoComments ) ;
815
+ statements . push ( transformedStatement ) ;
816
816
}
817
817
818
818
function getDeclarationName ( node : DeclarationStatement ) {
Original file line number Diff line number Diff line change
1
+ //// [commentOnExportEnumDeclaration.ts]
2
+ /**
3
+ * comment
4
+ */
5
+ export enum Color {
6
+ r , g , b
7
+ }
8
+
9
+ //// [commentOnExportEnumDeclaration.js]
10
+ "use strict" ;
11
+ /**
12
+ * comment
13
+ */
14
+ ( function ( Color ) {
15
+ Color [ Color [ "r" ] = 0 ] = "r" ;
16
+ Color [ Color [ "g" ] = 1 ] = "g" ;
17
+ Color [ Color [ "b" ] = 2 ] = "b" ;
18
+ } ) ( exports . Color || ( exports . Color = { } ) ) ;
19
+ var Color = exports . Color ;
Original file line number Diff line number Diff line change
1
+ === tests/cases/compiler/commentOnExportEnumDeclaration.ts ===
2
+ /**
3
+ * comment
4
+ */
5
+ export enum Color {
6
+ >Color : Symbol(Color, Decl(commentOnExportEnumDeclaration.ts, 0, 0))
7
+
8
+ r, g, b
9
+ >r : Symbol(Color.r, Decl(commentOnExportEnumDeclaration.ts, 3, 19))
10
+ >g : Symbol(Color.g, Decl(commentOnExportEnumDeclaration.ts, 4, 6))
11
+ >b : Symbol(Color.b, Decl(commentOnExportEnumDeclaration.ts, 4, 9))
12
+ }
Original file line number Diff line number Diff line change
1
+ === tests/cases/compiler/commentOnExportEnumDeclaration.ts ===
2
+ /**
3
+ * comment
4
+ */
5
+ export enum Color {
6
+ >Color : Color
7
+
8
+ r, g, b
9
+ >r : Color
10
+ >g : Color
11
+ >b : Color
12
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * comment
3
+ */
4
+ export enum Color {
5
+ r , g , b
6
+ }
You can’t perform that action at this time.
0 commit comments