From 87c1c6573c8489b0965155b611dc0323eef2bf1d Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 15 Jul 2015 11:49:27 -0700 Subject: [PATCH] Only remove triple-slash when compilerOptions.removecomments is true --- src/compiler/emitter.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index fd0d4ad796e..ba781f4b060 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -6891,12 +6891,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; } + // Omit /// comment if compilerOptions.removeComments is true. // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && + if (!compilerOptions.removeComments && (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.slash && - currentSourceFile.text.substring(comment.pos, comment.end).match(fullTripleSlashReferencePathRegEx)) { + currentSourceFile.text.substring(comment.pos, comment.end).match(fullTripleSlashReferencePathRegEx))) { return true; } }