validate against multiple parents on AST_Node (#4032)
- fix related issues in `global_defs`, `ie8` & `reduce_vars`
This commit is contained in:
@@ -3072,7 +3072,7 @@ merge(Compressor.prototype, {
|
||||
|
||||
(function(def) {
|
||||
function to_node(value, orig) {
|
||||
if (value instanceof AST_Node) return make_node(value.CTOR, orig, value);
|
||||
if (value instanceof AST_Node) return value.clone(true);
|
||||
if (Array.isArray(value)) return make_node(AST_Array, orig, {
|
||||
elements: value.map(function(value) {
|
||||
return to_node(value, orig);
|
||||
@@ -7642,6 +7642,8 @@ merge(Compressor.prototype, {
|
||||
single_use = false;
|
||||
} else if (recursive_ref(compressor, def)) {
|
||||
single_use = false;
|
||||
} else if (compressor.option("ie8") && fixed.name && def !== fixed.name.definition()) {
|
||||
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") {
|
||||
@@ -7650,8 +7652,6 @@ merge(Compressor.prototype, {
|
||||
scope.inlined = true;
|
||||
} while (scope = scope.parent_scope);
|
||||
}
|
||||
} else if (compressor.option("ie8") && fixed.name && def !== fixed.name.definition()) {
|
||||
single_use = false;
|
||||
}
|
||||
if (single_use) fixed.parent_scope = self.scope;
|
||||
} else if (!fixed || !fixed.is_constant_expression()) {
|
||||
|
||||
Reference in New Issue
Block a user