Don't emit detached comment if removeComment is true
This commit is contained in:
parent
5d15218cbe
commit
21ebc71325
5 changed files with 51 additions and 1 deletions
|
@ -7045,7 +7045,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
|
||||
function emitDetachedComments(node: TextRange) {
|
||||
let leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos);
|
||||
let leadingComments = filterComments(getLeadingCommentRanges(currentSourceFile.text, node.pos), node.pos === 0);
|
||||
if (leadingComments) {
|
||||
let detachedComments: CommentRange[] = [];
|
||||
let lastComment: CommentRange;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
//// [doNotEmitdetachedCommentAtStartOfFunctionBody.ts]
|
||||
function foo() {
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
//// [doNotEmitdetachedCommentAtStartOfFunctionBody.js]
|
||||
function foo() {
|
||||
return 42;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/compiler/doNotEmitdetachedCommentAtStartOfFunctionBody.ts ===
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(doNotEmitdetachedCommentAtStartOfFunctionBody.ts, 0, 0))
|
||||
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
return 42;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
=== tests/cases/compiler/doNotEmitdetachedCommentAtStartOfFunctionBody.ts ===
|
||||
function foo() {
|
||||
>foo : () => number
|
||||
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
return 42;
|
||||
>42 : number
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// @comments: false
|
||||
function foo() {
|
||||
/*
|
||||
|
||||
multi line
|
||||
comment
|
||||
*/
|
||||
|
||||
return 42;
|
||||
}
|
Loading…
Reference in a new issue