This commit is contained in:
Richard van Velzen 2013-10-29 13:38:18 -07:00
commit 712ed1ad5b
2 changed files with 16 additions and 1 deletions

View File

@ -1907,7 +1907,11 @@ merge(Compressor.prototype, {
// if right is a constant, whatever side effects the // if right is a constant, whatever side effects the
// left side might have could not influence the // left side might have could not influence the
// result. hence, force switch. // result. hence, force switch.
reverse(null, true);
if (!(self.left instanceof AST_Binary
&& PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) {
reverse(null, true);
}
} }
if (/^[!=]==?$/.test(self.operator)) { if (/^[!=]==?$/.test(self.operator)) {
if (self.left instanceof AST_SymbolRef && self.right instanceof AST_Conditional) { if (self.left instanceof AST_SymbolRef && self.right instanceof AST_Conditional) {

View File

@ -0,0 +1,11 @@
issue_267: {
options = { comparisons: true };
input: {
x = a % b / b * c * 2;
x = a % b * 2
}
expect: {
x = a % b / b * c * 2;
x = a % b * 2;
}
}