Fix trailingComments for FunctionExpression that is CallExpression arguments (#8488)

This commit is contained in:
Yi Li
2018-08-22 01:29:11 +08:00
committed by Brian Ng
parent f8b0a5579f
commit b439013cd4
3 changed files with 276 additions and 0 deletions

View File

@@ -122,6 +122,15 @@ export default class CommentsParser extends BaseParser {
lastComment.end <= node.end
) {
if (this.state.commentPreviousNode) {
for (j = 0; j < this.state.leadingComments.length; j++) {
if (
this.state.leadingComments[j].end <
this.state.commentPreviousNode.end
) {
this.state.leadingComments.splice(j, 1);
j--;
}
}
if (this.state.leadingComments.length > 0) {
lastArg.trailingComments = this.state.leadingComments;
this.state.leadingComments = [];