Skip to content

Commit

Permalink
parse parentheses-terminated statements correctly (#4774)
Browse files Browse the repository at this point in the history
fixes #4772
  • Loading branch information
alexlamsl committed Mar 14, 2021
1 parent 73e6b25 commit e124ef5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/parse.js
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions test/compress/arrows.js
Expand Up @@ -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"
}

0 comments on commit e124ef5

Please sign in to comment.