fix corner case in reduce_vars (#4654)

fixes #4653
This commit is contained in:
Alex Lam S.L
2021-02-15 22:46:45 +00:00
committed by GitHub
parent 76b27891c6
commit fa8aa204a0
2 changed files with 41 additions and 11 deletions

View File

@@ -853,18 +853,21 @@ merge(Compressor.prototype, {
}
return true;
function walk_prop(node) {
if (node instanceof AST_Dot) {
walk_prop(node.expression);
} else if (node instanceof AST_Sub) {
walk_prop(node.expression);
node.property.walk(tw);
} else if (node instanceof AST_SymbolRef) {
var d = node.definition();
push_ref(d, node);
node.fixed = d.fixed;
function walk_prop(lhs) {
if (lhs instanceof AST_Dot) {
walk_prop(lhs.expression);
} else if (lhs instanceof AST_Sub) {
walk_prop(lhs.expression);
lhs.property.walk(tw);
} else if (lhs instanceof AST_SymbolRef) {
var d = lhs.definition();
push_ref(d, lhs);
if (d.fixed) {
lhs.fixed = d.fixed;
lhs.fixed.assigns = [ node ];
}
} else {
node.walk(tw);
lhs.walk(tw);
}
}
});