fix corner case in collapse_vars (#5870)

fixes #5869
This commit is contained in:
Alex Lam S.L
2024-06-28 21:19:58 +03:00
committed by GitHub
parent 8c5a899986
commit 6b23899ef3
2 changed files with 29 additions and 1 deletions

View File

@@ -10333,3 +10333,27 @@ issue_1666_undefined_strict: {
}
expect_stdout: true
}
issue_5869: {
options = {
collapse_vars: true,
evaluate: true,
pure_getters: "strict",
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a, b, log = console.log;
log();
a.p = 0;
b = a;
log(b);
}
expect: {
var a, log = console.log;
log();
log(void (a.p = 0));
}
expect_stdout: TypeError("Cannot set properties of undefined")
}