improve compression of if conditions (#2544)

This commit is contained in:
Alex Lam S.L
2017-12-01 06:18:31 +08:00
committed by GitHub
parent b762f2d6f4
commit 5a1e99d713
6 changed files with 60 additions and 22 deletions

View File

@@ -1015,3 +1015,32 @@ delete_conditional_2: {
}
expect_stdout: true
}
issue_2535: {
options = {
booleans: true,
conditionals: true,
evaluate: true,
passes: 2,
side_effects: true,
}
input: {
if (true || x()) y();
if (true && x()) y();
if (x() || true) y();
if (x() && true) y();
if (false || x()) y();
if (false && x()) y();
if (x() || false) y();
if (x() && false) y();
}
expect: {
y();
x() && y();
(x(), 0) || y();
x() && y();
x() && y();
x() && y();
(x(), 1) || y();
}
}