fix corner case in collapse_vars (#5780)

fixes #5779
This commit is contained in:
Alex Lam S.L
2023-01-16 15:30:59 +02:00
committed by GitHub
parent a437a61518
commit f0ca9cfbe6
2 changed files with 30 additions and 1 deletions

View File

@@ -1761,6 +1761,11 @@ Compressor.prototype.compress = function(node) {
var identifier_atom = makePredicate("Infinity NaN undefined");
function is_lhs_read_only(lhs, compressor) {
if (lhs instanceof AST_Assign) {
if (lhs.operator != "=") return true;
if (lhs.right.tail_node().is_constant()) return true;
return is_lhs_read_only(lhs.left, compressor);
}
if (lhs instanceof AST_Atom) return true;
if (lhs instanceof AST_ObjectIdentity) return true;
if (lhs instanceof AST_PropAccess) {