aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/parse.js1
-rw-r--r--test/compress/loops.js14
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/parse.js b/lib/parse.js
index 415a20ee..dd8e70e9 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -1240,6 +1240,7 @@ function parse($TEXT, options) {
}
function for_enum(ctor, init) {
+ handle_regexp();
var obj = expression();
expect(")");
return new ctor({
diff --git a/test/compress/loops.js b/test/compress/loops.js
index 4ba0d075..c1f075cc 100644
--- a/test/compress/loops.js
+++ b/test/compress/loops.js
@@ -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,