account for side-effects from AST_This in collapse_vars (#2365)

This commit is contained in:
Alex Lam S.L
2017-10-17 01:18:55 +08:00
committed by GitHub
parent dfe4f6c6de
commit fe647b083e
2 changed files with 56 additions and 2 deletions

View File

@@ -950,9 +950,11 @@ merge(Compressor.prototype, {
scope = save_scope;
return true;
}
if (node instanceof AST_SymbolRef || node instanceof AST_PropAccess) {
if (node instanceof AST_PropAccess
|| node instanceof AST_SymbolRef
|| node instanceof AST_This) {
var sym = get_symbol(node);
if (sym instanceof AST_SymbolRef) {
if (sym instanceof AST_SymbolRef || node instanceof AST_This) {
lvalues[sym.name] = lvalues[sym.name] || is_lhs(node, tw.parent());
}
}