diff options
-rw-r--r-- | lib/compress.js | 1 | ||||
-rw-r--r-- | test/compress/const.js | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index b2ed17cf..3e6218a0 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -993,6 +993,7 @@ merge(Compressor.prototype, { return node.value; }; d.fixed.assigns = [ node ]; + if (node.name instanceof AST_SymbolConst && d.redefined()) d.single_use = false; } else { d.fixed = false; } diff --git a/test/compress/const.js b/test/compress/const.js index 27c55ddb..8c04c6b1 100644 --- a/test/compress/const.js +++ b/test/compress/const.js @@ -931,6 +931,30 @@ issue_4207: { expect_stdout: "0" } +issue_4218: { + options = { + reduce_funcs: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + { + const a = function() {}; + var b = 0 * a; + } + console.log(typeof a, b); + } + expect: { + { + const a = function() {}; + var b = 0 * a; + } + console.log(typeof a, b); + } + expect_stdout: true +} + issue_4210: { options = { reduce_vars: true, |