Skip to content

Commit

Permalink
fix corner case with for [await]...of (#4872)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed Apr 25, 2021
1 parent 324587f commit acf951a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/parse.js
Expand Up @@ -1240,6 +1240,7 @@ function parse($TEXT, options) {
}

function for_enum(ctor, init) {
handle_regexp();
var obj = expression();
expect(")");
return new ctor({
Expand Down
14 changes: 14 additions & 0 deletions test/compress/loops.js
Expand Up @@ -852,6 +852,20 @@ for_async_of: {
node_version: ">=0.12 <16"
}

for_of_regexp: {
input: {
for (var a of /foo/);
}
expect_exact: "for(var a of/foo/);"
}

for_await_of_regexp: {
input: {
for await (var a of /foo/);
}
expect_exact: "for await(var a of/foo/);"
}

issue_3631_1: {
options = {
dead_code: true,
Expand Down

0 comments on commit acf951a

Please sign in to comment.