var def = self.definition();
var fixed = self.fixed_value();
var single_use = def.single_use && !(parent instanceof AST_Call && parent.is_expr_pure(compressor));
- if (single_use && fixed instanceof AST_Lambda) {
- if (def.scope !== self.scope
- && (!compressor.option("reduce_funcs") || def.escaped.depth == 1 || fixed.inlined)) {
- single_use = false;
- } else if (recursive_ref(compressor, def)) {
- single_use = false;
- } else if (def.scope !== self.scope || def.orig[0] instanceof AST_SymbolFunarg) {
- single_use = fixed.is_constant_expression(self.scope);
- if (single_use == "f") {
- var scope = self.scope;
- do if (scope instanceof AST_Defun || scope instanceof AST_Function) {
- scope.inlined = true;
- } while (scope = scope.parent_scope);
+ if (single_use) {
+ if (fixed instanceof AST_Lambda) {
+ if (def.scope !== self.scope
+ && (!compressor.option("reduce_funcs") || def.escaped.depth == 1 || fixed.inlined)) {
+ single_use = false;
+ } else if (recursive_ref(compressor, def)) {
+ single_use = false;
+ } else if (def.scope !== self.scope || def.orig[0] instanceof AST_SymbolFunarg) {
+ single_use = fixed.is_constant_expression(self.scope);
+ if (single_use == "f") {
+ var scope = self.scope;
+ do if (scope instanceof AST_Defun || scope instanceof AST_Function) {
+ scope.inlined = true;
+ } while (scope = scope.parent_scope);
+ }
}
+ if (single_use) fixed.parent_scope = self.scope;
+ } else if (!fixed || !fixed.is_constant_expression()) {
+ single_use = false;
}
- if (single_use) fixed.parent_scope = self.scope;
}
- if (single_use && fixed) {
+ if (single_use) {
def.single_use = false;
fixed._squeezed = true;
fixed.single_use = true;