if (value instanceof AST_RegExp) return native_fns.RegExp[name] && !value.value.global;
}
- function is_modified(compressor, tw, node, value, level, immutable) {
+ function is_modified(compressor, tw, node, value, level, immutable, recursive) {
var parent = tw.parent(level);
if (compressor.option("unsafe") && parent instanceof AST_Dot && is_read_only_fn(value, parent.property)) {
return;
}
if (parent instanceof AST_PropAccess && parent.expression === node) {
var prop = read_property(value, parent);
- return !immutable && is_modified(compressor, tw, parent, prop, level + 1);
+ return (!immutable || recursive) && is_modified(compressor, tw, parent, prop, level + 1);
}
}
d.fixed = false;
} else if (d.fixed) {
value = this.fixed_value();
- if (recursive_ref(tw, d)) {
+ var recursive = recursive_ref(tw, d);
+ if (recursive) {
d.recursive_refs++;
} else if (value && ref_once(tw, compressor, d)) {
d.single_use = value instanceof AST_Lambda && !value.pinned()
} else {
d.single_use = false;
}
- if (is_modified(compressor, tw, this, value, 0, is_immutable(value))) {
+ if (is_modified(compressor, tw, this, value, 0, is_immutable(value), recursive)) {
if (d.single_use) {
d.single_use = "m";
} else {