account for exceptions in AST_Assign.left (#2892)

fixes #2891
This commit is contained in:
Alex Lam S.L
2018-02-08 03:31:51 +08:00
committed by GitHub
parent 905325d3e2
commit d66d86f20b
2 changed files with 63 additions and 2 deletions

View File

@@ -2758,8 +2758,13 @@ merge(Compressor.prototype, {
return any(this.elements, compressor);
});
def(AST_Assign, function(compressor){
return this.operator != "=" && this.left.may_throw(compressor)
|| this.right.may_throw(compressor);
if (this.right.may_throw(compressor)) return true;
if (!compressor.has_directive("use strict")
&& this.operator == "="
&& this.left instanceof AST_SymbolRef) {
return false;
}
return this.left.may_throw(compressor);
});
def(AST_Binary, function(compressor){
return this.left.may_throw(compressor)