fix corner case in `ie` (#5193)
authorAlex Lam S.L <alexlamsl@gmail.com>
Wed, 24 Nov 2021 09:29:26 +0000 (09:29 +0000)
committerGitHub <noreply@github.com>
Wed, 24 Nov 2021 09:29:26 +0000 (17:29 +0800)
fixes #5192

lib/compress.js
test/compress/default-values.js

index 115408d..b28ac5e 100644 (file)
@@ -456,7 +456,7 @@ merge(Compressor.prototype, {
     }
 
     function can_drop_symbol(ref, compressor, keep_lambda) {
-        var def = ref.definition();
+        var def = ref.redef || ref.definition();
         if (ref.in_arg && is_funarg(def)) return false;
         return all(def.orig, function(sym) {
             if (sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet) {
index 3a4d164..a7c0ed2 100644 (file)
@@ -1938,3 +1938,22 @@ issue_5138_2: {
     expect_stdout: "PASS"
     node_version: ">=6"
 }
+
+issue_5192: {
+    options = {
+        dead_code: true,
+        ie: true,
+    }
+    input: {
+        (function a(a,  [] = a = "PASS") {
+            console.log(a);
+        })("FAIL");
+    }
+    expect: {
+        (function a(a,  [] = a = "PASS") {
+            console.log(a);
+        })("FAIL");
+    }
+    expect_stdout: "PASS"
+    node_version: ">=6"
+}