fix corner case with `export` (#4871)
authorAlex Lam S.L <alexlamsl@gmail.com>
Sun, 25 Apr 2021 14:37:26 +0000 (15:37 +0100)
committerGitHub <noreply@github.com>
Sun, 25 Apr 2021 14:37:26 +0000 (22:37 +0800)
lib/parse.js
test/compress/exports.js

index 323769a..cdd607a 100644 (file)
@@ -1495,6 +1495,7 @@ function parse($TEXT, options) {
                 body.start = start;
                 body.end = prev();
             } else {
+                handle_regexp();
                 body = expression();
                 semicolon();
             }
index bc43628..0917648 100644 (file)
@@ -91,6 +91,13 @@ defaults_parentheses_6: {
     expect_exact: 'export default(function(){while(!console);})()?"FAIL":"PASS";'
 }
 
+defaults_regexp: {
+    input: {
+        export default /foo/;
+    }
+    expect_exact: "export default/foo/;"
+}
+
 foreign: {
     input: {
         export * from "foo";