fix for if (...) return; else return ...;

(it was assumed that the first `return` always contains a value)

close #22
This commit is contained in:
Mihai Bazon
2012-10-24 09:33:32 +03:00
parent 30faaf13ed
commit 70fd2b1f33
2 changed files with 19 additions and 2 deletions

View File

@@ -1220,8 +1220,8 @@ merge(Compressor.prototype, {
return make_node(self.body.CTOR, self, {
value: make_node(AST_Conditional, self, {
condition : self.condition,
consequent : self.body.value,
alternative : self.alternative.value || make_node(AST_Undefined, self).optimize(compressor)
consequent : self.body.value || make_node(AST_Undefined, self.body).optimize(compressor),
alternative : self.alternative.value || make_node(AST_Undefined, self.alternative).optimize(compressor)
})
}).transform(compressor);
}