@@ -4805,10 +4805,11 @@ merge(Compressor.prototype, {
|
||||
if (!all(fn.argnames, function(sym, index) {
|
||||
if (sym instanceof AST_DefaultValue) {
|
||||
if (!args) return false;
|
||||
if (args[index] !== undefined) return false;
|
||||
if (args[index] === undefined) {
|
||||
var value = sym.value._eval(compressor, ignore_side_effects, cached, depth);
|
||||
if (value === sym.value) return false;
|
||||
args[index] = value;
|
||||
}
|
||||
sym = sym.name;
|
||||
}
|
||||
return !(sym instanceof AST_Destructured);
|
||||
@@ -4842,6 +4843,9 @@ merge(Compressor.prototype, {
|
||||
if (!args || all(fn.argnames, function(sym, i) {
|
||||
return assign(sym, args[i]);
|
||||
}) && !(fn.rest && !assign(fn.rest, args.slice(fn.argnames.length))) || ignore_side_effects) {
|
||||
if (ignore_side_effects) fn.argnames.forEach(function(sym) {
|
||||
if (sym instanceof AST_DefaultValue) sym.value.walk(scan_modified);
|
||||
});
|
||||
fn.evaluating = true;
|
||||
val = val._eval(compressor, ignore_side_effects, cached, depth);
|
||||
delete fn.evaluating;
|
||||
|
||||
@@ -1904,3 +1904,37 @@ issue_5065: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_5138_1: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
}
|
||||
input: {
|
||||
console.log(function(a, b = a = "FAIL") {
|
||||
return a;
|
||||
}() && "PASS");
|
||||
}
|
||||
expect: {
|
||||
console.log(function(a, b = a = "FAIL") {
|
||||
return a;
|
||||
}() && "PASS");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_5138_2: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
}
|
||||
input: {
|
||||
console.log(function(a, b = a = "FAIL 1") {
|
||||
return a;
|
||||
}(null, "FAIL 2") || "PASS");
|
||||
}
|
||||
expect: {
|
||||
console.log((null, "PASS"));
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user