fix corner case in collapse_vars (#4855)

fixes #4854
This commit is contained in:
Alex Lam S.L
2021-04-13 18:22:08 +01:00
committed by GitHub
parent f1f4a4dd82
commit c53af3dfb1
2 changed files with 28 additions and 1 deletions

View File

@@ -1792,7 +1792,12 @@ merge(Compressor.prototype, {
right: candidate.value
});
}
candidate.write_only = false;
var assign = candidate;
while (assign.write_only) {
assign.write_only = false;
if (!(assign instanceof AST_Assign)) break;
assign = assign.right;
}
return candidate;
}
// These node types have child nodes that execute sequentially,