@@ -12831,7 +12831,36 @@ Compressor.prototype.compress = function(node) {
|
||||
def(AST_Node, noop);
|
||||
def(AST_Assign, noop);
|
||||
def(AST_Await, function(compressor, scope, no_return, in_loop) {
|
||||
return this.expression.try_inline(compressor, scope, no_return, in_loop);
|
||||
var self = this;
|
||||
var inlined = sync(self.expression).try_inline(compressor, scope, no_return, in_loop);
|
||||
if (!inlined) return;
|
||||
return aborts(inlined) ? inlined : make_node(AST_BlockStatement, self, {
|
||||
body: [ inlined, make_node(AST_SimpleStatement, self, {
|
||||
body: make_node(AST_Await, self, { expression: make_node(AST_Number, self, { value: 0 })}),
|
||||
}) ],
|
||||
});
|
||||
|
||||
function sync(node) {
|
||||
if (!no_return) return node;
|
||||
if (node.TYPE != "Call") return node;
|
||||
var fn = node.expression;
|
||||
switch (fn.CTOR) {
|
||||
case AST_AsyncArrow:
|
||||
fn = make_node(AST_Arrow, fn, fn);
|
||||
break;
|
||||
case AST_AsyncFunction:
|
||||
fn = make_node(AST_Function, fn, fn);
|
||||
break;
|
||||
case AST_AsyncGeneratorFunction:
|
||||
fn = make_node(AST_GeneratorFunction, fn, fn);
|
||||
break;
|
||||
default:
|
||||
return node;
|
||||
}
|
||||
node = node.clone();
|
||||
node.expression = fn;
|
||||
return node;
|
||||
}
|
||||
});
|
||||
def(AST_Binary, function(compressor, scope, no_return, in_loop) {
|
||||
if (no_return === undefined) return;
|
||||
@@ -12843,7 +12872,7 @@ Compressor.prototype.compress = function(node) {
|
||||
return make_node(AST_If, self, {
|
||||
condition: make_condition(self.left),
|
||||
body: inlined,
|
||||
alternative: null,
|
||||
alternative: no_return ? null : make_node(AST_Return, self, { value: null }),
|
||||
});
|
||||
|
||||
function make_condition(cond) {
|
||||
|
||||
Reference in New Issue
Block a user