diff options
-rw-r--r-- | lib/compress.js | 6 | ||||
-rw-r--r-- | test/compress/spreads.js | 20 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index 3653a5fa..675dc96c 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -11717,7 +11717,11 @@ merge(Compressor.prototype, { } else if (compressor.has_directive("use strict") || fn.name || fn.rest - || !(fn_parent instanceof AST_Call && index < fn_parent.args.length) + || !(fn_parent instanceof AST_Call + && index < fn_parent.args.length + && all(fn_parent.args.slice(0, index + 1), function(arg) { + return !(arg instanceof AST_Spread); + })) || !all(fn.argnames, function(argname) { return argname instanceof AST_SymbolFunarg; })) { diff --git a/test/compress/spreads.js b/test/compress/spreads.js index 6e37bf18..7ef118e1 100644 --- a/test/compress/spreads.js +++ b/test/compress/spreads.js @@ -1156,3 +1156,23 @@ issue_4882_3: { ] node_version: ">=8" } + +issue_5006: { + options = { + arguments: true, + } + input: { + console.log(function(b, c) { + c = "FAIL 2"; + return arguments[1]; + }(...[], "FAIL 1") || "PASS"); + } + expect: { + console.log(function(b, c) { + c = "FAIL 2"; + return arguments[1]; + }(...[], "FAIL 1") || "PASS"); + } + expect_stdout: "PASS" + node_version: ">=6" +} |