@@ -3570,9 +3570,10 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
var args = eval_args(this.args);
|
var args = eval_args(this.args);
|
||||||
if (!args && !ignore_side_effects) return this;
|
if (!args && !ignore_side_effects) return this;
|
||||||
if (!stat.value) return;
|
var val = stat.value;
|
||||||
|
if (!val) return;
|
||||||
var cached_args = [];
|
var cached_args = [];
|
||||||
if (args && !all(fn.argnames, function(sym, i) {
|
if (!args || all(fn.argnames, function(sym, i) {
|
||||||
var value = args[i];
|
var value = args[i];
|
||||||
var def = sym.definition();
|
var def = sym.definition();
|
||||||
if (def.orig[def.orig.length - 1] !== sym) return false;
|
if (def.orig[def.orig.length - 1] !== sym) return false;
|
||||||
@@ -3583,15 +3584,15 @@ merge(Compressor.prototype, {
|
|||||||
cached_args.push(node);
|
cached_args.push(node);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}) && !ignore_side_effects) return this;
|
}) || ignore_side_effects) {
|
||||||
fn.evaluating = true;
|
fn.evaluating = true;
|
||||||
var val = stat.value._eval(compressor, ignore_side_effects, cached, depth);
|
val = val._eval(compressor, ignore_side_effects, cached, depth);
|
||||||
delete fn.evaluating;
|
delete fn.evaluating;
|
||||||
|
}
|
||||||
cached_args.forEach(function(node) {
|
cached_args.forEach(function(node) {
|
||||||
delete node._eval;
|
delete node._eval;
|
||||||
});
|
});
|
||||||
if (val === stat.value) return this;
|
return val === stat.value ? this : val;
|
||||||
return val;
|
|
||||||
} else if (compressor.option("unsafe") && exp instanceof AST_PropAccess) {
|
} else if (compressor.option("unsafe") && exp instanceof AST_PropAccess) {
|
||||||
var key = exp.property;
|
var key = exp.property;
|
||||||
if (key instanceof AST_Node) {
|
if (key instanceof AST_Node) {
|
||||||
|
|||||||
@@ -2444,3 +2444,22 @@ issue_3903: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3905: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
passes: 2,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function(a, a) {
|
||||||
|
return console.log(a = 0), a && console.log("FAIL");
|
||||||
|
})("foo", 42);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function(a, a) {
|
||||||
|
return console.log(a = 0), a && console.log("FAIL");
|
||||||
|
})("foo", 42);
|
||||||
|
}
|
||||||
|
expect_stdout: "0"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user