fix corner case in collapse_vars (#3898)

fixes #3897
This commit is contained in:
Alex Lam S.L
2020-05-14 18:09:54 +01:00
committed by GitHub
parent 938368ba21
commit 5ef7060098
2 changed files with 40 additions and 4 deletions

View File

@@ -8050,3 +8050,37 @@ issue_3894: {
"PASS",
]
}
issue_3897: {
options = {
collapse_vars: true,
}
input: {
var a = 0;
(function() {
function f(b) {
b = a = 1 + a;
a = 1 + a;
console.log(b);
}
f();
})();
console.log(a);
}
expect: {
var a = 0;
(function() {
function f(b) {
b = a = 1 + a;
a = 1 + a;
console.log(b);
}
f();
})();
console.log(a);
}
expect_stdout: [
"1",
"2",
]
}