aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 813561c4..0bbd24ee 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -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];
});