fix corner case in collapse_vars (#5720)

fixes #5719
This commit is contained in:
Alex Lam S.L
2022-10-24 15:16:06 +01:00
committed by GitHub
parent fb1bff2c0a
commit 30bf068768
2 changed files with 28 additions and 1 deletions

View File

@@ -10121,3 +10121,30 @@ issue_5643: {
}
expect_stdout: "42"
}
issue_5719: {
options = {
collapse_vars: true,
reduce_vars: true,
toplevel: true,
}
input: {
var a = 42, b;
switch (b = a) {
case a:
case b:
case a++:
}
console.log(a === b++ ? "PASS" : "FAIL");
}
expect: {
var a = 42, b;
switch (b = a) {
case a:
case b:
case a++:
}
console.log(a === b++ ? "PASS" : "FAIL");
}
expect_stdout: "PASS"
}