fix corner cases in pure_getters & reduce_vars (#5859)

fixes #5856
fixes #5857
fixes #5858
This commit is contained in:
Alex Lam S.L
2024-06-20 17:43:55 +03:00
committed by GitHub
parent 8195a664fd
commit 95d3ede664
4 changed files with 82 additions and 17 deletions

View File

@@ -1687,3 +1687,31 @@ issue_4939: {
}
expect_stdout: "PASS"
}
issue_5856: {
options = {
pure_getters: true,
reduce_vars: true,
side_effects: true,
unused: true,
}
input: {
var a = [ "FAIL", "PASS" ];
(function(b) {
var c = b[0];
b[0] = b[1];
b[1] = c;
})(a);
console.log(a[0]);
}
expect: {
var a = [ "FAIL", "PASS" ];
(function(b) {
var c = b[0];
b[0] = b[1];
b[1] = c;
})(a);
console.log(a[0]);
}
expect_stdout: "PASS"
}