self.body = self.alternative || make_node(AST_EmptyStatement, self);
self.alternative = tmp;
}
- if (is_empty(self.body) && is_empty(self.alternative)) {
- return make_node(AST_SimpleStatement, self.condition, {
- body: self.condition.clone()
- }).optimize(compressor);
- }
if (self.body instanceof AST_SimpleStatement
&& self.alternative instanceof AST_SimpleStatement) {
return make_node(AST_SimpleStatement, self, {
}).transform(compressor)
}).optimize(compressor);
}
- if (self.body instanceof AST_EmptyStatement
- && self.alternative instanceof AST_SimpleStatement) {
- return make_node(AST_SimpleStatement, self, {
+ if (is_empty(self.body)) {
+ if (is_empty(self.alternative)) return make_node(AST_SimpleStatement, self.condition, {
+ body: self.condition.clone()
+ }).optimize(compressor);
+ if (self.alternative instanceof AST_SimpleStatement) return make_node(AST_SimpleStatement, self, {
body: make_node(AST_Binary, self, {
operator : "||",
left : self.condition,
right : self.alternative.body
}).transform(compressor)
}).optimize(compressor);
+ self = make_node(AST_If, self, {
+ condition: negated,
+ body: self.alternative,
+ alternative: null
+ });
}
if (self.body instanceof AST_Exit
&& self.alternative instanceof AST_Exit