File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,6 +156,9 @@ namespace ts {
156156
157157 if ( ! skipTrailingComments ) {
158158 emitLeadingComments ( detachedRange . end , /*isEmittedNode*/ true ) ;
159+ if ( hasWrittenComment && ! writer . isAtStartOfLine ( ) ) {
160+ writer . writeLine ( ) ;
161+ }
159162 }
160163
161164 if ( extendedDiagnostics ) {
Original file line number Diff line number Diff line change @@ -101,20 +101,21 @@ namespace ts {
101101 // So the helper will be emit at the correct position instead of at the top of the source-file
102102 const moduleName = tryGetModuleNameFromFile ( node , host , compilerOptions ) ;
103103 const dependencies = createArrayLiteral ( map ( dependencyGroups , dependencyGroup => dependencyGroup . name ) ) ;
104- const updated = updateSourceFileNode (
105- node ,
106- createNodeArray ( [
107- createStatement (
108- createCall (
109- createPropertyAccess ( createIdentifier ( "System" ) , "register" ) ,
104+ const updated = setEmitFlags (
105+ updateSourceFileNode (
106+ node ,
107+ createNodeArray ( [
108+ createStatement (
109+ createCall (
110+ createPropertyAccess ( createIdentifier ( "System" ) , "register" ) ,
110111 /*typeArguments*/ undefined ,
111- moduleName
112- ? [ moduleName , dependencies , moduleBodyFunction ]
113- : [ dependencies , moduleBodyFunction ]
112+ moduleName
113+ ? [ moduleName , dependencies , moduleBodyFunction ]
114+ : [ dependencies , moduleBodyFunction ]
115+ )
114116 )
115- )
116- ] , node . statements )
117- ) ;
117+ ] , node . statements )
118+ ) , EmitFlags . NoTrailingComments ) ;
118119
119120 if ( ! ( compilerOptions . outFile || compilerOptions . out ) ) {
120121 moveEmitHelpers ( updated , moduleBodyBlock , helper => ! helper . scoped ) ;
Original file line number Diff line number Diff line change 1+ //// [systemModuleTrailingComments.ts]
2+ export const test = "TEST" ;
3+
4+ //some comment
5+
6+ //// [systemModuleTrailingComments.js]
7+ System . register ( [ ] , function ( exports_1 , context_1 ) {
8+ "use strict" ;
9+ var __moduleName = context_1 && context_1 . id ;
10+ var test ;
11+ return {
12+ setters : [ ] ,
13+ execute : function ( ) {
14+ exports_1 ( "test" , test = "TEST" ) ;
15+ //some comment
16+ }
17+ } ;
18+ } ) ;
Original file line number Diff line number Diff line change 1+ === tests/cases/compiler/systemModuleTrailingComments.ts ===
2+ export const test = "TEST";
3+ >test : Symbol(test, Decl(systemModuleTrailingComments.ts, 0, 12))
4+
5+ //some comment
Original file line number Diff line number Diff line change 1+ === tests/cases/compiler/systemModuleTrailingComments.ts ===
2+ export const test = "TEST";
3+ >test : "TEST"
4+ >"TEST" : "TEST"
5+
6+ //some comment
Original file line number Diff line number Diff line change 1+ // @module : system
2+ export const test = "TEST" ;
3+
4+ //some comment
You can’t perform that action at this time.
0 commit comments