diff --git a/lib/compress.js b/lib/compress.js index 55c8f854..2d8fe36a 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -7240,6 +7240,7 @@ Compressor.prototype.compress = function(node) { }); var index = indexOf_assign(sym, def); if (index >= 0) assign_in_use[sym.id][index] = assign; + sym.assignments++; sym.eliminated++; return assign; })); diff --git a/test/compress/destructured.js b/test/compress/destructured.js index 2ef7acee..8e1faa36 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -3567,3 +3567,32 @@ issue_5423: { expect_stdout: "function" node_version: ">=6" } + +issue_5454: { + options = { + hoist_props: true, + reduce_vars: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + function f(a) { + var a = 42, a = { + p: [ a ] = [], + }; + return "PASS"; + } + console.log(f()); + } + expect: { + console.log(function(a) { + a = 42, a = { + p: [ a ] = [], + }; + return "PASS"; + }()); + } + expect_stdout: "PASS" + node_version: ">=6" +}