fix corner case in collapse_vars (#4892)

fixes #4891
This commit is contained in:
Alex Lam S.L
2021-05-01 20:57:17 +01:00
committed by GitHub
parent 53b57ee57e
commit 6ab26eef6c
2 changed files with 37 additions and 1 deletions

View File

@@ -9057,3 +9057,31 @@ issue_4874: {
}
expect_stdout: "PASS"
}
issue_4891: {
options = {
collapse_vars: true,
reduce_vars: true,
toplevel: true,
}
input: {
var a = 0, b;
a++;
console.log(b = a, b);
b--;
a.a += 0;
console.log(b);
}
expect: {
var a = 0, b;
a++;
console.log(a, b = a);
b--;
a.a += 0;
console.log(b);
}
expect_stdout: [
"1 1",
"0",
]
}