enhance unsafe_math (#4093)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user