fix corner cases in join_vars (#3787)

fixes #3786
fixes #3788
This commit is contained in:
Alex Lam S.L
2020-04-17 14:19:18 +01:00
committed by GitHub
parent 9110fac9a2
commit 15a3ebd467
4 changed files with 667 additions and 601 deletions

View File

@@ -2365,8 +2365,9 @@ merge(Compressor.prototype, {
if (expr.operator != "=") break;
var lhs = expr.left;
if (!(lhs instanceof AST_SymbolRef)) break;
if (is_undeclared_ref(lhs)) break;
var def = lhs.definition();
if (def.scope !== scope) break;
if (def.scope !== definitions[0].name.scope) break;
var name = make_node(AST_SymbolVar, lhs, lhs);
definitions.push(make_node(AST_VarDef, expr, {
name: name,