fix corner case in collapse_vars (#5644)

fixes #5643
This commit is contained in:
Alex Lam S.L
2022-09-04 03:10:31 +01:00
committed by GitHub
parent 78f354beb8
commit 1d42e9ad55
2 changed files with 29 additions and 2 deletions

View File

@@ -3416,13 +3416,17 @@ Compressor.prototype.compress = function(node) {
if (def.references.length - def.replaced == referenced) return true;
if (!def.fixed) return false;
if (!lhs.fixed) return false;
var assigns = lhs.fixed.assigns;
var matched = 0;
if (!all(def.references, function(ref, index) {
var fixed = ref.fixed;
if (!fixed) return false;
if (fixed.to_binary || fixed.to_prefix) return false;
if (fixed === lhs.fixed) matched++;
return true;
if (fixed === lhs.fixed) {
matched++;
return true;
}
return assigns && fixed.assigns && assigns[0] !== fixed.assigns[0];
})) return false;
if (matched != referenced) return false;
verify_ref = true;