fix corner cases of catch variable inlining (#4169)

This commit is contained in:
Alex Lam S.L
2020-10-03 00:02:28 +01:00
committed by GitHub
parent 35465d590e
commit baf4903aa7
5 changed files with 193 additions and 26 deletions

View File

@@ -4853,3 +4853,42 @@ direct_inline: {
}
expect_stdout: "21"
}
direct_inline_catch_redefined: {
options = {
inline: true,
reduce_vars: true,
toplevel: true,
}
input: {
var a = 1;
function f() {
return a;
}
try {
throw 2;
} catch (a) {
function g() {
return a;
}
console.log(a, f(), g());
}
console.log(a, f(), g());
}
expect: {
var a = 1;
function f() {
return a;
}
try {
throw 2;
} catch (a) {
function g() {
return a;
}
console.log(a, f(), g());
}
console.log(a, a, g());
}
expect_stdout: true
}