fix corner case in merge_vars (#4957)

fixes #4956
This commit is contained in:
Alex Lam S.L
2021-05-24 02:56:02 +01:00
committed by GitHub
parent 8b0c836515
commit eb08fed120
3 changed files with 79 additions and 2 deletions

View File

@@ -5789,7 +5789,7 @@ merge(Compressor.prototype, {
if (!tail_refs) continue;
if (head_refs.start.block !== tail_refs.start.block
|| !mergeable(head_refs, tail_refs)
|| head_refs.start.loop && !mergeable(tail_refs, head_refs)
|| (head_refs.start.loop || !same_scope(def)) && !mergeable(tail_refs, head_refs)
|| !all(tail_refs, function(sym) {
return sym.scope.find_variable(def.name) === def;
})) {