remove hack in collapse_vars (#2457)

fixes #2456
This commit is contained in:
Alex Lam S.L
2017-11-09 20:00:58 +08:00
committed by GitHub
parent 4c0b0177b6
commit 246d9d4e83
2 changed files with 33 additions and 2 deletions

View File

@@ -1062,7 +1062,7 @@ merge(Compressor.prototype, {
var found = false;
return statements[stat_index].transform(new TreeTransformer(function(node, descend, in_list) {
if (found) return node;
if (node === expr) {
if (node === expr || node.body === expr) {
found = true;
if (node instanceof AST_VarDef) {
drop_decl(node.name.definition());
@@ -1076,7 +1076,6 @@ merge(Compressor.prototype, {
case 0: return null;
case 1: return node.expressions[0];
}
if (node instanceof AST_SimpleStatement && !node.body) return null;
}));
}