fix corner case in unsafe_math (#3677)

fixes #3676
This commit is contained in:
Alex Lam S.L
2020-01-08 10:28:10 +08:00
committed by GitHub
parent f5ceff6e4b
commit 14c35739dd
2 changed files with 35 additions and 1 deletions

View File

@@ -6529,7 +6529,9 @@ merge(Compressor.prototype, {
&& self.right.is_number(compressor)
&& (self.operator != "+"
|| self.right.left.is_boolean(compressor)
|| self.right.left.is_number(compressor))) {
|| self.right.left.is_number(compressor))
&& (self.right.left.is_constant_expression()
|| !self.right.right.has_side_effects(compressor))) {
self = make_node(AST_Binary, self, {
operator: align(self.operator, self.right.operator),
left: make_node(AST_Binary, self.left, {