def(AST_Node, return_true);
def(AST_Constant, return_false);
- def(AST_Destructured, return_true);
def(AST_EmptyStatement, return_false);
def(AST_Lambda, return_false);
def(AST_ObjectIdentity, return_false);
}
return this.left.may_throw(compressor);
});
+ def(AST_Await, function(compressor) {
+ return this.expression.may_throw(compressor);
+ });
def(AST_Binary, function(compressor) {
return this.left.may_throw(compressor)
|| this.right.may_throw(compressor)
return !this.optional && this.expression.may_throw_on_access(compressor)
|| this.expression.may_throw(compressor);
});
+ def(AST_ForEnumeration, function(compressor) {
+ if (this.init.may_throw(compressor)) return true;
+ var obj = this.object.tail_node();
+ if (!(obj instanceof AST_Array || obj.is_string(compressor))) return true;
+ return this.body.may_throw(compressor);
+ });
def(AST_If, function(compressor) {
return this.condition.may_throw(compressor)
|| this.body && this.body.may_throw(compressor)
defined.set("arguments", true);
}
var async = is_async(fn);
- if (async && !(compressor.option("awaits") && is_async(scope))) return;
+ if (async) {
+ if (!compressor.option("awaits")) return;
+ if (!is_async(scope)) return;
+ if (call.may_throw(compressor)) return;
+ }
var names = scope.var_names();
if (in_loop) in_loop = [];
if (!fn.variables.all(function(def, name) {