@@ -446,7 +446,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
446446 /** If removeComments is true, no leading-comments needed to be emitted **/
447447 let emitLeadingCommentsOfPosition = compilerOptions . removeComments ? function ( pos : number ) { } : emitLeadingCommentsOfPositionWorker ;
448448
449- let moduleEmitDelegates : Map < ( node : SourceFile , startIndex : number ) => void > = {
449+ let moduleEmitDelegates : Map < ( node : SourceFile ) => void > = {
450450 [ ModuleKind . ES6 ] : emitES6Module ,
451451 [ ModuleKind . AMD ] : emitAMDModule ,
452452 [ ModuleKind . System ] : emitSystemModule ,
@@ -6594,7 +6594,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
65946594 write ( "}" ) ; // execute
65956595 }
65966596
6597- function emitSystemModule ( node : SourceFile , startIndex : number ) : void {
6597+ function emitSystemModule ( node : SourceFile ) : void {
65986598 collectExternalModuleInfo ( node ) ;
65996599 // System modules has the following shape
66006600 // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */})
@@ -6639,6 +6639,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
66396639 write ( `], function(${ exportFunctionForFile } ) {` ) ;
66406640 writeLine ( ) ;
66416641 increaseIndent ( ) ;
6642+ let startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ true ) ;
66426643 emitEmitHelpers ( node ) ;
66436644 emitCaptureThisForNodeIfNecessary ( node ) ;
66446645 emitSystemModuleBody ( node , dependencyGroups , startIndex ) ;
@@ -6732,7 +6733,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
67326733 write ( ") {" ) ;
67336734 }
67346735
6735- function emitAMDModule ( node : SourceFile , startIndex : number ) {
6736+ function emitAMDModule ( node : SourceFile ) {
67366737 emitEmitHelpers ( node ) ;
67376738 collectExternalModuleInfo ( node ) ;
67386739
@@ -6743,6 +6744,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
67436744 }
67446745 emitAMDDependencies ( node , /*includeNonAmdDependencies*/ true ) ;
67456746 increaseIndent ( ) ;
6747+ let startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ true ) ;
67466748 emitExportStarHelper ( ) ;
67476749 emitCaptureThisForNodeIfNecessary ( node ) ;
67486750 emitLinesStartingAt ( node . statements , startIndex ) ;
@@ -6753,7 +6755,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
67536755 write ( "});" ) ;
67546756 }
67556757
6756- function emitCommonJSModule ( node : SourceFile , startIndex : number ) {
6758+ function emitCommonJSModule ( node : SourceFile ) {
6759+ let startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ false ) ;
67576760 emitEmitHelpers ( node ) ;
67586761 collectExternalModuleInfo ( node ) ;
67596762 emitExportStarHelper ( ) ;
@@ -6763,7 +6766,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
67636766 emitExportEquals ( /*emitAsReturn*/ false ) ;
67646767 }
67656768
6766- function emitUMDModule ( node : SourceFile , startIndex : number ) {
6769+ function emitUMDModule ( node : SourceFile ) {
67676770 emitEmitHelpers ( node ) ;
67686771 collectExternalModuleInfo ( node ) ;
67696772
@@ -6782,6 +6785,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
67826785})(` ) ;
67836786 emitAMDFactoryHeader ( dependencyNames ) ;
67846787 increaseIndent ( ) ;
6788+ let startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ true ) ;
67856789 emitExportStarHelper ( ) ;
67866790 emitCaptureThisForNodeIfNecessary ( node ) ;
67876791 emitLinesStartingAt ( node . statements , startIndex ) ;
@@ -6792,11 +6796,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
67926796 write ( "});" ) ;
67936797 }
67946798
6795- function emitES6Module ( node : SourceFile , startIndex : number ) {
6799+ function emitES6Module ( node : SourceFile ) {
67966800 externalImports = undefined ;
67976801 exportSpecifiers = undefined ;
67986802 exportEquals = undefined ;
67996803 hasExportStars = false ;
6804+ let startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ false ) ;
68006805 emitEmitHelpers ( node ) ;
68016806 emitCaptureThisForNodeIfNecessary ( node ) ;
68026807 emitLinesStartingAt ( node . statements , startIndex ) ;
@@ -6985,14 +6990,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
69856990 emitShebang ( ) ;
69866991 emitDetachedComments ( node ) ;
69876992
6988- // emit prologue directives prior to __extends
6989- let startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ false ) ;
6990-
69916993 if ( isExternalModule ( node ) || compilerOptions . isolatedModules ) {
69926994 let emitModule = moduleEmitDelegates [ modulekind ] || moduleEmitDelegates [ ModuleKind . CommonJS ] ;
6993- emitModule ( node , startIndex ) ;
6995+ emitModule ( node ) ;
69946996 }
69956997 else {
6998+ // emit prologue directives prior to __extends
6999+ let startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ false ) ;
69967000 externalImports = undefined ;
69977001 exportSpecifiers = undefined ;
69987002 exportEquals = undefined ;
0 commit comments