enhance inline (#5535)

This commit is contained in:
Alex Lam S.L
2022-07-01 04:24:16 +01:00
committed by GitHub
parent 4c227cc6bd
commit 51deeff72e
10 changed files with 84 additions and 31 deletions

View File

@@ -13553,7 +13553,6 @@ Compressor.prototype.compress = function(node) {
if (fn.body[0] instanceof AST_Directive) return;
if (fn.contains_this()) return;
if (!scope) scope = find_scope(compressor);
if (in_async_generator(scope)) return;
var defined = new Dictionary();
defined.set("NaN", true);
while (!(scope instanceof AST_Scope)) {
@@ -13624,7 +13623,7 @@ Compressor.prototype.compress = function(node) {
}));
return !abort;
};
} else if (in_await && !is_async(fn)) {
} else if (in_await && !is_async(fn) || in_async_generator(scope)) {
verify_body = function(stat) {
var abort = false;
var find_return = new TreeWalker(function(node) {
@@ -13735,7 +13734,7 @@ Compressor.prototype.compress = function(node) {
node.value = make_node(AST_Await, call, { expression: value });
});
body.push(make_node(AST_Return, call, {
value: make_node(AST_Undefined, call).transform(compressor),
value: in_async_generator(scope) ? make_node(AST_Undefined, call).transform(compressor) : null,
}));
}
return inlined;