From 1409d7437d138315583d7095400b6d958998f2cd Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Mon, 17 Jun 2024 00:55:49 +0300 Subject: [PATCH] fix corner case in `inline` fixes #5842 --- lib/compress.js | 2 +- test/compress/yields.js | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/compress.js b/lib/compress.js index 5cf2a2e6613..4e9cf95d2c1 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -14166,7 +14166,7 @@ Compressor.prototype.compress = function(node) { stat.walk(find_return); return !abort; }) && node.bcatch) node.bcatch.walk(find_return); - return true; + return; } if (node instanceof AST_Scope) return true; })); diff --git a/test/compress/yields.js b/test/compress/yields.js index 0736adaa0d2..933fc295179 100644 --- a/test/compress/yields.js +++ b/test/compress/yields.js @@ -2207,3 +2207,43 @@ issue_5754: { ] node_version: ">=10" } + +issue_5842: { + options = { + inline: true, + } + input: { + var a = "FAIL"; + (async function*() { + (function() { + try { + try { + return console; + } finally { + a = "PASS"; + } + } catch (e) {} + FAIL; + })(); + })().next(); + console.log(a); + } + expect: { + var a = "FAIL"; + (async function*() { + (function() { + try { + try { + return console; + } finally { + a = "PASS"; + } + } catch (e) {} + FAIL; + })(); + })().next(); + console.log(a); + } + expect_stdout: "PASS" + node_version: ">=10" +}