fix collapse_vars regression in destructuring (#2897)

fixes #2896
This commit is contained in:
kzc
2018-02-08 15:28:35 -05:00
committed by Alex Lam S.L
parent aebc916215
commit 569757d14d
3 changed files with 35 additions and 1 deletions

View File

@@ -1512,6 +1512,7 @@ merge(Compressor.prototype, {
}
function may_modify(sym) {
if (!sym.definition) return true; // AST_Destructuring
var def = sym.definition();
if (def.orig.length == 1 && def.orig[0] instanceof AST_SymbolDefun) return false;
if (def.scope.get_defun_scope() !== scope) return true;