compress function.call()
This commit is contained in:
parent
b29fc8b27c
commit
fb0f8fb899
|
|
@ -3846,6 +3846,17 @@ merge(Compressor.prototype, {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "call":
|
||||||
|
if (exp.expression instanceof AST_Function && !exp.expression.contains_this()) {
|
||||||
|
return make_sequence(this, [
|
||||||
|
self.args[0],
|
||||||
|
make_node(AST_Call, self, {
|
||||||
|
expression: exp.expression,
|
||||||
|
args: self.args.slice(1)
|
||||||
|
})
|
||||||
|
]).optimize(compressor);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (compressor.option("unsafe_Func")
|
if (compressor.option("unsafe_Func")
|
||||||
|
|
|
||||||
|
|
@ -923,3 +923,29 @@ issue_2604_2: {
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe_call: {
|
||||||
|
options = {
|
||||||
|
inline: true,
|
||||||
|
passes: 2,
|
||||||
|
reduce_vars: true,
|
||||||
|
side_effects: true,
|
||||||
|
unsafe: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function(a, b) {
|
||||||
|
console.log(a, b);
|
||||||
|
}).call("foo", "bar");
|
||||||
|
(function(a, b) {
|
||||||
|
console.log(this, a, b);
|
||||||
|
}).call("foo", "bar");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log("bar", void 0);
|
||||||
|
(function(a, b) {
|
||||||
|
console.log(this, a, b);
|
||||||
|
}).call("foo", "bar");
|
||||||
|
}
|
||||||
|
expect_stdout: true
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user