extend reduce_funcs to cover cross-scope substitutions (#2469)
fixes #2468
This commit is contained in:
@@ -4256,10 +4256,11 @@ merge(Compressor.prototype, {
|
||||
var fixed = self.fixed_value();
|
||||
if (fixed instanceof AST_Defun) {
|
||||
d.fixed = fixed = make_node(AST_Function, fixed, fixed);
|
||||
if (!compressor.option("reduce_funcs")) d.single_use = false;
|
||||
}
|
||||
if (d.single_use && fixed instanceof AST_Function) {
|
||||
if (d.escaped && d.scope !== self.scope || recursive_ref(compressor, d)) {
|
||||
if (!compressor.option("reduce_funcs") && d.scope !== self.scope) {
|
||||
d.single_use = false;
|
||||
} else if (d.escaped && d.scope !== self.scope || recursive_ref(compressor, d)) {
|
||||
d.single_use = false;
|
||||
} else if (d.scope !== self.scope || d.orig[0] instanceof AST_SymbolFunarg) {
|
||||
d.single_use = fixed.is_constant_expression(self.scope);
|
||||
|
||||
Reference in New Issue
Block a user