}
} else if (!(value instanceof AST_Node)) {
var exp = branch.expression.evaluate(compressor);
+ if (!(exp instanceof AST_Node) && exp !== value) {
+ eliminate_branch(branch, body[body.length - 1]);
+ continue;
+ }
+ if (exp instanceof AST_Node) exp = branch.expression.tail_node().evaluate(compressor);
if (exp === value) {
exact_match = branch;
if (default_branch) {
eliminate_branch(default_branch, body[default_index - 1]);
default_branch = null;
}
- } else if (exp !== branch.expression) {
- eliminate_branch(branch, body[body.length - 1]);
- continue;
}
}
if (aborts(branch)) {
});
self.walk(tw);
if (!has_break) {
- body = body[0].body.slice();
- body.unshift(make_node(AST_SimpleStatement, self.expression, {
- body: self.expression
+ var statements = body[0].body.slice();
+ var exp = body[0].expression;
+ if (exp) statements.unshift(make_node(AST_SimpleStatement, exp, {
+ body: exp
+ }));
+ statements.unshift(make_node(AST_SimpleStatement, self.expression, {
+ body:self.expression
}));
return make_node(AST_BlockStatement, self, {
- body: body
+ body: statements
}).optimize(compressor);
}
}