enhance inline, sequences & side_effects (#4493)
This commit is contained in:
@@ -8018,7 +8018,7 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
}
|
||||
var fn = exp instanceof AST_SymbolRef ? exp.fixed_value() : exp;
|
||||
var is_func = fn instanceof AST_Arrow || fn instanceof AST_Defun || fn instanceof AST_Function;
|
||||
var is_func = fn instanceof AST_Lambda && (!is_async(fn) || compressor.parent() instanceof AST_Await);
|
||||
var stat = is_func && fn.first_statement();
|
||||
var has_default = false;
|
||||
var can_drop = is_func && all(fn.argnames, function(argname, index) {
|
||||
@@ -8649,6 +8649,19 @@ merge(Compressor.prototype, {
|
||||
? self : try_evaluate(compressor, self);
|
||||
});
|
||||
|
||||
OPT(AST_Await, function(self, compressor) {
|
||||
if (compressor.option("sequences")) {
|
||||
var seq = lift_sequence_in_expression(self, compressor);
|
||||
if (seq !== self) return seq.optimize(compressor);
|
||||
}
|
||||
if (compressor.option("side_effects")) {
|
||||
var exp = self.expression;
|
||||
if (exp instanceof AST_Await) return exp;
|
||||
if (exp instanceof AST_UnaryPrefix && exp.expression instanceof AST_Await) return exp;
|
||||
}
|
||||
return self;
|
||||
});
|
||||
|
||||
AST_Binary.DEFMETHOD("lift_sequences", function(compressor) {
|
||||
if (this.left instanceof AST_PropAccess) {
|
||||
if (!(this.left.expression instanceof AST_Sequence)) return this;
|
||||
|
||||
Reference in New Issue
Block a user