@@ -190,6 +190,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
190
190
/** Sourcemap data that will get encoded */
191
191
let sourceMapData : SourceMapData ;
192
192
193
+ /** If removeComments is true, no leading-comments needed to be emitted **/
194
+ let emitLeadingCommentsOfPosition = compilerOptions . removeComments ? function ( pos : number ) { } : emitLeadingCommentsOfPositionWorker ;
195
+
193
196
if ( compilerOptions . sourceMap || compilerOptions . inlineSourceMap ) {
194
197
initializeEmitterWithSourceMaps ( ) ;
195
198
}
@@ -6986,17 +6989,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
6986
6989
}
6987
6990
6988
6991
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 ;
6992
6994
}
6993
6995
6994
6996
/**
6995
6997
* Determine if the given comment is a triple-slash
6996
6998
*
6997
6999
* @return true if the comment is a triple-slash comment else false
6998
7000
**/
6999
- function isTripleSlashComments ( comment : CommentRange ) {
7001
+ function isTripleSlashComment ( comment : CommentRange ) {
7000
7002
// Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text
7001
7003
// so that we don't end up computing comment string and doing match for all // comments
7002
7004
if ( currentSourceFile . text . charCodeAt ( comment . pos + 1 ) === CharacterCodes . slash &&
@@ -7065,7 +7067,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
7065
7067
// interface F {}
7066
7068
// The first /// will NOT be removed while the second one will be removed eventhough both node will not be emitted
7067
7069
if ( node . pos === 0 ) {
7068
- leadingComments = filter ( getLeadingCommentsToEmit ( node ) , isTripleSlashComments ) ;
7070
+ leadingComments = filter ( getLeadingCommentsToEmit ( node ) , isTripleSlashComment ) ;
7069
7071
}
7070
7072
}
7071
7073
@@ -7103,7 +7105,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
7103
7105
emitComments ( currentSourceFile , writer , trailingComments , /*trailingSeparator*/ true , newLine , writeComment ) ;
7104
7106
}
7105
7107
7106
- function emitLeadingCommentsOfPosition ( pos : number ) {
7108
+ function emitLeadingCommentsOfPositionWorker ( pos : number ) {
7107
7109
if ( compilerOptions . removeComments ) {
7108
7110
return ;
7109
7111
}
0 commit comments