Add attachComment parser option to disable comment attachment (#13229)

This commit is contained in:
Huáng Jùnliàng
2021-08-04 11:04:22 -04:00
committed by GitHub
parent fc3b09e533
commit d5b0d9e33d
11 changed files with 274 additions and 18 deletions

View File

@@ -403,7 +403,7 @@ export default class Tokenizer extends ParserErrors {
const comment = this.skipBlockComment();
if (comment !== undefined) {
this.addComment(comment);
comments.push(comment);
if (this.options.attachComment) comments.push(comment);
}
break;
}
@@ -412,7 +412,7 @@ export default class Tokenizer extends ParserErrors {
const comment = this.skipLineComment(2);
if (comment !== undefined) {
this.addComment(comment);
comments.push(comment);
if (this.options.attachComment) comments.push(comment);
}
break;
}
@@ -436,7 +436,7 @@ export default class Tokenizer extends ParserErrors {
const comment = this.skipLineComment(3);
if (comment !== undefined) {
this.addComment(comment);
comments.push(comment);
if (this.options.attachComment) comments.push(comment);
}
} else {
break loop;
@@ -452,7 +452,7 @@ export default class Tokenizer extends ParserErrors {
const comment = this.skipLineComment(4);
if (comment !== undefined) {
this.addComment(comment);
comments.push(comment);
if (this.options.attachComment) comments.push(comment);
}
} else {
break loop;