fix corner case in booleans (#4375)

fixes #4374
This commit is contained in:
Alex Lam S.L
2020-12-12 21:01:38 +00:00
committed by GitHub
parent af97629912
commit 5d19bb8d5d
2 changed files with 35 additions and 8 deletions

View File

@@ -153,3 +153,31 @@ issue_3690: {
}
expect_stdout: "PASS"
}
issue_4374: {
options = {
booleans: true,
conditionals: true,
if_return: true,
reduce_vars: true,
unused: true,
}
input: {
(function() {
console.log(f());
function f(a) {
if (null) return 0;
if (a) return 1;
return 0;
}
})();
}
expect: {
(function() {
console.log(function(a) {
return !null && a ? 1 : 0;
}());
})();
}
expect_stdout: "0"
}