fix corner case in hoist_vars (#5627)

fixes #5626
This commit is contained in:
Alex Lam S.L
2022-08-23 17:19:47 +01:00
committed by GitHub
parent 4653e8aec0
commit 4db81065ee
6 changed files with 119 additions and 65 deletions

View File

@@ -1652,6 +1652,8 @@ fn_name_unused: {
hoist_vars: {
options = {
hoist_vars: true,
join_vars: true,
unused: true,
}
input: {
var a = "PASS";
@@ -1659,8 +1661,7 @@ hoist_vars: {
console.log(a, b);
}
expect: {
var a = "PASS";
var [ b ] = [ 42 ];
var a = "PASS", b = [ 42 ][0];
console.log(a, b);
}
expect_stdout: "PASS 42"