diff options
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/compress.js b/lib/compress.js index 7355ff53..1ae5e8eb 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -7556,13 +7556,15 @@ merge(Compressor.prototype, { && self.left.is_number(compressor)) { if (self.left.left instanceof AST_Constant) { var lhs = make_binary(self.left, self.operator, self.left.left, self.right, self.left.left.start, self.right.end); - self = make_binary(self, self.left.operator, lhs, self.left.right); + self = make_binary(self, self.left.operator, try_evaluate(compressor, lhs), self.left.right); } else if (self.left.right instanceof AST_Constant) { - var rhs = make_binary(self.left, align(self.left.operator, self.operator), self.left.right, self.right, self.left.right.start, self.right.end); - if (self.left.operator != "-" - || !self.right.value - || rhs.evaluate(compressor) - || !self.left.left.is_negative_zero()) { + var op = align(self.left.operator, self.operator); + var rhs = try_evaluate(compressor, make_binary(self.left, op, self.left.right, self.right)); + if (rhs.is_constant() + && !(self.left.operator == "-" + && self.right.value != 0 + && +rhs.value == 0 + && self.left.left.is_negative_zero())) { self = make_binary(self, self.left.operator, self.left.left, rhs); } } |