fix corner case in `ie8` (#3826)
authorAlex Lam S.L <alexlamsl@gmail.com>
Mon, 27 Apr 2020 08:51:21 +0000 (09:51 +0100)
committerGitHub <noreply@github.com>
Mon, 27 Apr 2020 08:51:21 +0000 (16:51 +0800)
fixes #3825

lib/compress.js
test/compress/ie8.js

index a42095c..8eb684d 100644 (file)
@@ -4938,7 +4938,7 @@ merge(Compressor.prototype, {
             }
             if (!compressor.option("ie8")) return node;
             if (node) exprs.push(node);
-            return make_sequence(this, exprs);
+            return exprs.length == 0 ? null : make_sequence(this, exprs);
         });
         def(AST_Constant, return_null);
         def(AST_Dot, function(compressor, first_in_statement) {
index 8f81b01..0c79ece 100644 (file)
@@ -2445,3 +2445,18 @@ issue_3823: {
     }
     expect_stdout: "PASS undefined"
 }
+
+issue_3825: {
+    options = {
+        ie8: true,
+        pure_getters: "strict",
+        side_effects: true,
+    }
+    input: {
+        console.log({}[void (0..length ? 1 : 2)]);
+    }
+    expect: {
+        console.log({}[void 0]);
+    }
+    expect_stdout: "undefined"
+}