enhance merge_vars (#5308)
This commit is contained in:
@@ -6245,8 +6245,10 @@ Compressor.prototype.compress = function(node) {
|
||||
|| !mergeable(head_refs, tail_refs)
|
||||
|| (head_refs.start.loop || !same_scope(def)) && !mergeable(tail_refs, head_refs)
|
||||
|| compressor.option("webkit") && is_funarg(def) !== is_funarg(head.definition)
|
||||
|| !safe_to_rename(head_refs, def)
|
||||
|| !safe_to_rename(references[def.id], head.definition)) {
|
||||
|| head.definition.const_redefs
|
||||
|| !all(head_refs, function(sym) {
|
||||
return sym.scope.find_variable(def.name) === def;
|
||||
})) {
|
||||
skipped.push(head);
|
||||
continue;
|
||||
}
|
||||
@@ -6348,12 +6350,6 @@ Compressor.prototype.compress = function(node) {
|
||||
function mergeable(head, tail) {
|
||||
return must_visit(head.start, head.end) || must_visit(head.start, tail.start);
|
||||
}
|
||||
|
||||
function safe_to_rename(refs, def) {
|
||||
return all(refs, function(sym) {
|
||||
return sym.scope.find_variable(def.name) === def;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function fill_holes(orig, elements) {
|
||||
|
||||
Reference in New Issue
Block a user