diff --git a/lib/compress.js b/lib/compress.js index 423e134584..f3e40f7e60 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -6226,6 +6226,7 @@ merge(Compressor.prototype, { && var_defs[sym.id] == 1 && sym.assignments == 0 && value instanceof AST_LambdaExpression + && !is_arguments(sym) && !is_arrow(value) && assigned_once(value, sym.references) && can_declare_defun(value) diff --git a/test/compress/functions.js b/test/compress/functions.js index f0e0d50fd9..4d4cb66de3 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -5991,3 +5991,33 @@ issue_4788: { } expect_stdout: "PASS" } + +issue_4823: { + options = { + functions: true, + reduce_vars: true, + unused: true, + } + input: { + console.log(typeof function() { + { + function f() {} + var arguments = f(); + function g() {} + var arguments = g; + } + return f && arguments; + }()); + } + expect: { + console.log(typeof function() { + { + function f() {} + arguments = f(); + var arguments = function() {}; + } + return f && arguments; + }()); + } + expect_stdout: "function" +}