aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-14 20:11:29 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-03-17 17:56:17 -0700
commite4462dc1b20ce152bf71546927d401844124df02 (patch)
tree8601c57da52e887be3d175a4d59b6563455c0277 /tools
parent3215f80b20f5cf98390c43a2c5c8b3f4ebcdd984 (diff)
filter out empty blocks in simplifyIfs
Diffstat (limited to 'tools')
-rw-r--r--tools/js-optimizer.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 7900044a..76d33f89 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -831,7 +831,9 @@ function simplifyIfs(ast) {
if (type === 'if' && !node[3]) {
var body = node[2];
// recurse to handle chains
- while (body[0] === 'block' && body[1].length === 1) {
+ while (body[0] === 'block') {
+ if (body[1].length > 1) body[1] = filterEmptyNodes(body[1]);
+ if (body[1].length !== 1) break;
var singleton = body[1][0];
if (singleton[0] === 'if' && !singleton[3]) {
node[1] = ['conditional', node[1], singleton[1], ['num', 0]];