diff --git a/lib/compress.js b/lib/compress.js index f62becb0..590015ff 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -277,12 +277,6 @@ merge(Compressor.prototype, { d.fixed = false; } } - if (node instanceof AST_Lambda) { - node.variables.get("arguments").fixed = null; - node.argnames.forEach(function(arg) { - arg.definition().fixed = null; - }); - } if (node instanceof AST_Defun) { var d = node.name.definition(); if (!toplevel && d.global || is_safe(d)) { @@ -364,7 +358,7 @@ merge(Compressor.prototype, { function is_safe(def) { for (var i = safe_ids.length, id = def.id; --i >= 0;) { if (safe_ids[i][id]) { - if (def.fixed === null) { + if (def.fixed == null) { var orig = def.orig[0]; if (orig instanceof AST_SymbolFunarg || orig.name == "arguments") return false; def.fixed = make_node(AST_Undefined, orig); diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index a76d476f..87942ab9 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -1823,3 +1823,34 @@ redefine_farg_3: { } expect_stdout: "object number undefined" } + +delay_def: { + options = { + evaluate: true, + reduce_vars: true, + unused: true, + } + input: { + function f() { + return a; + var a; + } + function g() { + return a; + var a = 1; + } + console.log(f(), g()); + } + expect: { + function f() { + return a; + var a; + } + function g() { + return a; + var a = 1; + } + console.log(f(), g()); + } + expect_stdout: true +}