@@ -7692,7 +7692,9 @@ merge(Compressor.prototype, {
|
||||
return !(arg instanceof AST_Spread);
|
||||
})) return;
|
||||
var pos = 0, last = 0;
|
||||
var drop_fargs = fn === exp && !fn.name && compressor.drop_fargs(fn, call) ? function(argname, arg) {
|
||||
var is_iife = fn === exp && !fn.name;
|
||||
var drop_defaults = is_iife && compressor.option("default_values");
|
||||
var drop_fargs = is_iife && compressor.drop_fargs(fn, call) ? function(argname, arg) {
|
||||
if (!argname) return true;
|
||||
if (argname instanceof AST_DestructuredArray) {
|
||||
return argname.elements.length == 0 && arg instanceof AST_Array;
|
||||
@@ -7705,9 +7707,7 @@ merge(Compressor.prototype, {
|
||||
var side_effects = [];
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
var argname = fn.argnames[i];
|
||||
if (compressor.option("default_values")
|
||||
&& argname instanceof AST_DefaultValue
|
||||
&& args[i].is_defined(compressor)) {
|
||||
if (drop_defaults && argname instanceof AST_DefaultValue && args[i].is_defined(compressor)) {
|
||||
fn.argnames[i] = argname = argname.name;
|
||||
}
|
||||
if (!argname || "__unused" in argname) {
|
||||
|
||||
@@ -1313,3 +1313,31 @@ issue_4485_3: {
|
||||
expect_stdout: true
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_4496: {
|
||||
options = {
|
||||
default_values: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
(function f(a = 0) {
|
||||
console.log(function(b) {
|
||||
a && b();
|
||||
return a;
|
||||
}(f));
|
||||
})(42);
|
||||
}
|
||||
expect: {
|
||||
(function f(a = 0) {
|
||||
console.log(function(b) {
|
||||
a && b();
|
||||
return a;
|
||||
}(f));
|
||||
})(42);
|
||||
}
|
||||
expect_stdout: [
|
||||
"0",
|
||||
"42",
|
||||
]
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user