@@ -190,6 +190,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
190190 /** Sourcemap data that will get encoded */
191191 let sourceMapData : SourceMapData ;
192192
193+ /** If removeComments is true, no leading-comments needed to be emitted **/
194+ let emitLeadingCommentsOfPosition = compilerOptions . removeComments ? function ( pos : number ) { } : emitLeadingCommentsOfPositionWorker ;
195+
193196 if ( compilerOptions . sourceMap || compilerOptions . inlineSourceMap ) {
194197 initializeEmitterWithSourceMaps ( ) ;
195198 }
@@ -6986,17 +6989,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
69866989 }
69876990
69886991 function isPinnedComments ( comment : CommentRange ) {
6989- if ( currentSourceFile . text . charCodeAt ( comment . pos + 1 ) === CharacterCodes . asterisk ) {
6990- return currentSourceFile . text . charCodeAt ( comment . pos + 2 ) === CharacterCodes . exclamation ;
6991- }
6992+ return currentSourceFile . text . charCodeAt ( comment . pos + 1 ) === CharacterCodes . asterisk &&
6993+ currentSourceFile . text . charCodeAt ( comment . pos + 2 ) === CharacterCodes . exclamation ;
69926994 }
69936995
69946996 /**
69956997 * Determine if the given comment is a triple-slash
69966998 *
69976999 * @return true if the comment is a triple-slash comment else false
69987000 **/
6999- function isTripleSlashComments ( comment : CommentRange ) {
7001+ function isTripleSlashComment ( comment : CommentRange ) {
70007002 // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text
70017003 // so that we don't end up computing comment string and doing match for all // comments
70027004 if ( currentSourceFile . text . charCodeAt ( comment . pos + 1 ) === CharacterCodes . slash &&
@@ -7065,7 +7067,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
70657067 // interface F {}
70667068 // The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted
70677069 if ( node . pos === 0 ) {
7068- leadingComments = filter ( getLeadingCommentsToEmit ( node ) , isTripleSlashComments ) ;
7070+ leadingComments = filter ( getLeadingCommentsToEmit ( node ) , isTripleSlashComment ) ;
70697071 }
70707072 }
70717073
@@ -7103,7 +7105,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
71037105 emitComments ( currentSourceFile , writer , trailingComments , /*trailingSeparator*/ true , newLine , writeComment ) ;
71047106 }
71057107
7106- function emitLeadingCommentsOfPosition ( pos : number ) {
7108+ function emitLeadingCommentsOfPositionWorker ( pos : number ) {
71077109 if ( compilerOptions . removeComments ) {
71087110 return ;
71097111 }
0 commit comments