Fix regression after e4c5302406

`x * (y * z)` ==> `x * y * z` -- the better place to do this is in the
compressor rather than codegen.
This commit is contained in:
Mihai Bazon
2013-10-30 10:45:58 +02:00
parent 9dd97605bc
commit b70670b69f

View File

@@ -2089,6 +2089,19 @@ merge(Compressor.prototype, {
}
}
}
// x * (y * z) ==> x * y * z
if (self.right instanceof AST_Binary
&& self.right.operator == self.operator
&& (self.operator == "*" || self.operator == "&&" || self.operator == "||"))
{
self.left = make_node(AST_Binary, self.left, {
operator : self.operator,
left : self.left,
right : self.right.left
});
self.right = self.right.right;
return self.transform(compressor);
}
return self.evaluate(compressor)[0];
});