fix corner cases in collapse_vars & unused (#4807)

fixes #4806
This commit is contained in:
Alex Lam S.L
2021-03-20 19:51:03 +00:00
committed by GitHub
parent b89cc84c3a
commit 24619daf68
3 changed files with 121 additions and 13 deletions

View File

@@ -8857,3 +8857,26 @@ dot_non_local: {
}
expect_stdout: "42"
}
issue_4806: {
options = {
collapse_vars: true,
}
input: {
var a, o = {
f: function() {
console.log(this === o ? "FAIL" : "PASS");
},
};
(a = 42, o.f)(42);
}
expect: {
var a, o = {
f: function() {
console.log(this === o ? "FAIL" : "PASS");
},
};
(0, o.f)(a = 42);
}
expect_stdout: "PASS"
}