fix corner case in if_return (#5755)

fixes #5754
This commit is contained in:
Alex Lam S.L
2022-12-02 05:05:36 +02:00
committed by GitHub
parent 650e63c8aa
commit 404794f5db
2 changed files with 42 additions and 1 deletions

View File

@@ -3759,7 +3759,10 @@ Compressor.prototype.compress = function(node) {
if (!in_lambda) return false;
if (!(ab instanceof AST_Return)) return false;
var value = ab.value;
if (value && !is_undefined(value.tail_node())) return false;
if (value) {
if (!drop_return_void) return false;
if (!is_undefined(value.tail_node())) return false;
}
if (!(self instanceof AST_SwitchBranch)) return true;
if (!jump) return false;
if (jump instanceof AST_Exit && jump.value) return false;