diff options
-rw-r--r-- | lib/compress.js | 7 | ||||
-rw-r--r-- | test/compress/default-values.js | 22 |
2 files changed, 27 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js index bcffd8b8..8652d6e4 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -4957,7 +4957,10 @@ merge(Compressor.prototype, { node.right.walk(tw); var marker = new TreeWalker(function(node) { if (node instanceof AST_Destructured) return; - if (node instanceof AST_DestructuredKeyVal) { + if (node instanceof AST_DefaultValue) { + node.value.walk(tw); + node.name.walk(marker); + } else if (node instanceof AST_DestructuredKeyVal) { if (node.key instanceof AST_Node) { push(); segment.block = node; @@ -5177,7 +5180,7 @@ merge(Compressor.prototype, { node.name.mark_symbol(node.value ? function(node) { if (!(node instanceof AST_SymbolDeclaration)) return; if (node instanceof AST_SymbolVar) { - mark(node, false); + mark(node); } else { references[node.definition().id] = false; } diff --git a/test/compress/default-values.js b/test/compress/default-values.js index 8e5910d9..23e31748 100644 --- a/test/compress/default-values.js +++ b/test/compress/default-values.js @@ -1527,3 +1527,25 @@ issue_4510_2: { expect_stdout: "PASS" node_version: ">=8" } + +issue_4523: { + options = { + merge_vars: true, + } + input: { + console.log(function() { + var a, b; + [ a = b = false ] = [ "FAIL" ]; + return b || "PASS"; + }()); + } + expect: { + console.log(function() { + var a, b; + [ a = b = false ] = [ "FAIL" ]; + return b || "PASS"; + }()); + } + expect_stdout: "PASS" + node_version: ">=6" +} |