From b70670b69fbc3badd6186d6a6671754976bd36cb Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Wed, 30 Oct 2013 10:45:58 +0200 Subject: [PATCH] Fix regression after e4c530240650535d1cb46569dfb013193471af05 `x * (y * z)` ==> `x * y * z` -- the better place to do this is in the compressor rather than codegen. --- lib/compress.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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]; }); -- 2.34.1