fix corner case in collapse_vars (#5026)

fixes #5025
This commit is contained in:
Alex Lam S.L
2021-06-22 22:03:11 +01:00
committed by GitHub
parent 95090dbf24
commit 8b05677c15
4 changed files with 34 additions and 9 deletions

View File

@@ -6228,3 +6228,33 @@ recursive_collapse: {
}
expect_stdout: "PASS"
}
issue_5025: {
options = {
collapse_vars: true,
inline: true,
reduce_vars: true,
unused: true,
}
input: {
function f(a) {
function g() {
b = 42;
}
g(b = a);
var b = this;
console.log(typeof b);
}
f();
}
expect: {
function f(a) {
b = a,
void (b = 42);
var b = this;
console.log(typeof b);
}
f();
}
expect_stdout: "object"
}