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 @@ -804,17 +804,17 @@ namespace ts {
804
804
* Adds a trailing VariableStatement for an enum or module declaration.
805
805
*/
806
806
function addVarForExportedEnumOrNamespaceDeclaration ( statements : Statement [ ] , node : EnumDeclaration | ModuleDeclaration ) {
807
- statements . push (
808
- createVariableStatement (
809
- /*modifiers*/ undefined ,
810
- [ createVariableDeclaration (
811
- getDeclarationName ( node ) ,
807
+ const transformedStatement = createVariableStatement (
808
+ /*modifiers*/ undefined ,
809
+ [ createVariableDeclaration (
810
+ getDeclarationName ( node ) ,
812
811
/*type*/ undefined ,
813
- createPropertyAccess ( createIdentifier ( "exports" ) , getDeclarationName ( node ) )
814
- ) ] ,
812
+ createPropertyAccess ( createIdentifier ( "exports" ) , getDeclarationName ( node ) )
813
+ ) ] ,
815
814
/*location*/ node
816
- )
817
815
) ;
816
+ setNodeEmitFlags ( transformedStatement , NodeEmitFlags . NoComments ) ;
817
+ statements . push ( transformedStatement ) ;
818
818
}
819
819
820
820
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