@@ -5669,8 +5669,9 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
if (node.rest) {
|
if (node.rest) {
|
||||||
node.rest = node.rest.transform(trimmer);
|
node.rest = node.rest.transform(trimmer);
|
||||||
if (node.rest instanceof AST_DestructuredArray && node.rest.elements.length == 0
|
if (!(node.uses_arguments && !tt.has_directive("use strict"))
|
||||||
|| node.rest instanceof AST_DestructuredObject && node.rest.properties.length == 0) {
|
&& (node.rest instanceof AST_DestructuredArray && node.rest.elements.length == 0
|
||||||
|
|| node.rest instanceof AST_DestructuredObject && node.rest.properties.length == 0)) {
|
||||||
node.rest = null;
|
node.rest = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10467,6 +10468,7 @@ merge(Compressor.prototype, {
|
|||||||
argname = null;
|
argname = null;
|
||||||
} else if (compressor.has_directive("use strict")
|
} else if (compressor.has_directive("use strict")
|
||||||
|| fn.name
|
|| 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.argnames, function(argname) {
|
|| !all(fn.argnames, function(argname) {
|
||||||
return argname instanceof AST_SymbolFunarg;
|
return argname instanceof AST_SymbolFunarg;
|
||||||
|
|||||||
@@ -485,3 +485,43 @@ keep_arguments: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4525_1: {
|
||||||
|
options = {
|
||||||
|
arguments: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log(function(a, ...[]) {
|
||||||
|
a = "FAIL";
|
||||||
|
return arguments[0];
|
||||||
|
}("PASS"));
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(function(a, ...[]) {
|
||||||
|
a = "FAIL";
|
||||||
|
return arguments[0];
|
||||||
|
}("PASS"));
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_4525_2: {
|
||||||
|
options = {
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log(function(a, ...[]) {
|
||||||
|
a = "FAIL";
|
||||||
|
return arguments[0];
|
||||||
|
}("PASS"));
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(function(a, ...[]) {
|
||||||
|
a = "FAIL";
|
||||||
|
return arguments[0];
|
||||||
|
}("PASS"));
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user