retrofit try-catch-finally as block-scoped (#4178)

- support optional catch binding
This commit is contained in:
Alex Lam S.L
2020-10-04 22:30:14 +01:00
committed by GitHub
parent f9946767c9
commit 8f0521d51d
8 changed files with 74 additions and 19 deletions

View File

@@ -427,7 +427,7 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
if (node.TYPE == "Call" && node.expression.print_to_string() == "console.log") {
return to_sequence(node.args);
}
if (node instanceof U.AST_Catch) {
if (node instanceof U.AST_Catch && node.argname) {
descend(node, this);
node.body.unshift(new U.AST_SimpleStatement({
body: wrap_with_console_log(new U.AST_SymbolRef(node.argname)),