@@ -3452,15 +3452,16 @@ Compressor.prototype.compress = function(node) {
34523452 var parent = compressor.parent();
34533453 var self = compressor.self();
34543454 var declare_only, jump, merge_jump;
3455- var in_iife = in_lambda && parent && parent.TYPE == "Call" && parent.expression === self;
3456- var chain_if_returns = in_lambda && compressor.option("conditionals") && compressor.option("sequences");
3455+ var in_tail = in_lambda && self instanceof AST_Block && self.body === statements;
3456+ var in_iife = in_tail && parent && parent.TYPE == "Call" && parent.expression === self;
3457+ var chain_if_returns = in_tail && compressor.option("conditionals") && compressor.option("sequences");
34573458 var multiple_if_returns = has_multiple_if_returns(statements);
34583459 for (var i = statements.length; --i >= 0;) {
34593460 var stat = statements[i];
34603461 var j = next_index(i);
34613462 var next = statements[j];
34623463
3463- if (in_lambda && declare_only && !next && stat instanceof AST_Return
3464+ if (in_tail && declare_only && !next && stat instanceof AST_Return
34643465 && !(self instanceof AST_SwitchBranch)
34653466 && !(in_try && in_try.bfinally && in_async_generator(in_lambda))) {
34663467 var body = stat.value;
@@ -3563,7 +3564,7 @@ Compressor.prototype.compress = function(node) {
35633564 // if (foo()) return x; [ return ; ] ---> return foo() ? x : undefined;
35643565 // if (foo()) return bar() ? x : void 0; ---> return foo() && bar() ? x : void 0;
35653566 // if (foo()) return bar() ? void 0 : x; ---> return !foo() || bar() ? void 0 : x;
3566- if (in_lambda && declare_only && !next && !stat.alternative && (in_bool
3567+ if (in_tail && declare_only && !next && !stat.alternative && (in_bool
35673568 || value && multiple_if_returns
35683569 || value instanceof AST_Conditional && (is_undefined(value.consequent, compressor)
35693570 || is_undefined(value.alternative, compressor)))) {
@@ -3644,7 +3645,7 @@ Compressor.prototype.compress = function(node) {
36443645 function can_drop_abort(ab) {
36453646 if (ab instanceof AST_Exit) {
36463647 if (merge_jump = match_return(ab)) return true;
3647- if (!in_lambda ) return false;
3648+ if (!in_tail ) return false;
36483649 if (!(ab instanceof AST_Return)) return false;
36493650 var value = ab.value;
36503651 if (value && !is_undefined(value.tail_node())) return false;
@@ -3657,7 +3658,7 @@ Compressor.prototype.compress = function(node) {
36573658 if (!(ab instanceof AST_LoopControl)) return false;
36583659 if (jump && self instanceof AST_SwitchBranch) {
36593660 if (jump instanceof AST_Exit) {
3660- if (!in_lambda ) return false;
3661+ if (!in_tail ) return false;
36613662 if (jump.value) return false;
36623663 } else if (compressor.loopcontrol_target(jump) !== parent) {
36633664 return false;
@@ -6162,7 +6163,8 @@ Compressor.prototype.compress = function(node) {
61626163 function opt_arrow(self, compressor) {
61636164 if (!compressor.option("arrows")) return self;
61646165 drop_rest_farg(self, compressor);
6165- var body = tighten_body(self.value ? [ self.first_statement() ] : self.body, compressor);
6166+ if (self.value) self.body = [ self.first_statement() ];
6167+ var body = tighten_body(self.body, compressor);
61666168 switch (body.length) {
61676169 case 1:
61686170 var stat = body[0];
0 commit comments