Skip to content

Commit 8dc99fa

Browse files
authored
fix corner case in inline (#5846)
fixes #5842
1 parent dc51a23 commit 8dc99fa

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

lib/compress.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14166,7 +14166,7 @@ Compressor.prototype.compress = function(node) {
1416614166
stat.walk(find_return);
1416714167
return !abort;
1416814168
}) && node.bcatch) node.bcatch.walk(find_return);
14169-
return true;
14169+
return;
1417014170
}
1417114171
if (node instanceof AST_Scope) return true;
1417214172
}));

test/compress/yields.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,3 +2207,43 @@ issue_5754: {
22072207
]
22082208
node_version: ">=10"
22092209
}
2210+
2211+
issue_5842: {
2212+
options = {
2213+
inline: true,
2214+
}
2215+
input: {
2216+
var a = "FAIL";
2217+
(async function*() {
2218+
(function() {
2219+
try {
2220+
try {
2221+
return console;
2222+
} finally {
2223+
a = "PASS";
2224+
}
2225+
} catch (e) {}
2226+
FAIL;
2227+
})();
2228+
})().next();
2229+
console.log(a);
2230+
}
2231+
expect: {
2232+
var a = "FAIL";
2233+
(async function*() {
2234+
(function() {
2235+
try {
2236+
try {
2237+
return console;
2238+
} finally {
2239+
a = "PASS";
2240+
}
2241+
} catch (e) {}
2242+
FAIL;
2243+
})();
2244+
})().next();
2245+
console.log(a);
2246+
}
2247+
expect_stdout: "PASS"
2248+
node_version: ">=10"
2249+
}

0 commit comments

Comments
 (0)