parse parentheses-terminated statements correctly (#4774)

fixes #4772
This commit is contained in:
Alex Lam S.L
2021-03-14 06:09:29 +00:00
committed by GitHub
parent 73e6b2550b
commit e124ef57e3
2 changed files with 14 additions and 1 deletions

View File

@@ -1835,7 +1835,10 @@ function parse($TEXT, options) {
expect(")");
var end = prev();
end.comments_before = ex.end.comments_before;
[].push.apply(ex.end.comments_after, end.comments_after);
end.comments_after.forEach(function(comment) {
ex.end.comments_after.push(comment);
if (comment.nlb) S.token.nlb = true;
});
end.comments_after.length = 0;
end.comments_after = ex.end.comments_after;
ex.end = end;

View File

@@ -803,3 +803,13 @@ issue_4687_2: {
expect_stdout: "PASS"
node_version: ">=4"
}
issue_4772: {
input: {
var f = a => (a)
/**/ console.log(f("PASS"));
}
expect_exact: 'var f=a=>a;console.log(f("PASS"));'
expect_stdout: "PASS"
node_version: ">=4"
}