fix corner case in reduce_vars (#4665)

fixes #4664
This commit is contained in:
Alex Lam S.L
2021-02-18 18:04:33 +00:00
committed by GitHub
parent 7b4fd858ba
commit 10de27ca3d
3 changed files with 36 additions and 6 deletions

View File

@@ -56,3 +56,31 @@ evaluate: {
expect_stdout: "5"
node_version: ">=8"
}
issue_4664: {
options = {
collapse_vars: true,
evaluate: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
function f() {
new function(a) {
console.log(typeof f, a, typeof this);
}((A = 0, (NaN ^ 1) * 2 ** 30), 0);
}
f();
}
expect: {
(function f() {
new function(a) {
console.log(typeof f, 2 ** 30, typeof this);
}(0, A = 0);
})();
}
expect_stdout: "function 1073741824 object"
node_version: ">=8"
}