aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-30 16:09:00 +0800
committerGitHub <noreply@github.com>2017-03-30 16:09:00 +0800
commit7cb1adf455f8ab440e1971ae41265c1f7f9a806a (patch)
treeb58d92e4b41b874c4987403c631d240ec1317a03 /lib
parent7bea38a05dbe357434001fe59dbe06bb659a585f (diff)
downloadtracifyjs-7cb1adf455f8ab440e1971ae41265c1f7f9a806a.tar.gz
tracifyjs-7cb1adf455f8ab440e1971ae41265c1f7f9a806a.zip
remove paranthesis for `-(x*y)` (#1732)
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index be760152..ac7ea357 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3034,6 +3034,13 @@ merge(Compressor.prototype, {
})).optimize(compressor);
}
}
+ if (e instanceof AST_Binary
+ && (self.operator == "+" || self.operator == "-")
+ && (e.operator == "*" || e.operator == "/" || e.operator == "%")) {
+ self.expression = e.left;
+ e.left = self;
+ return e.optimize(compressor);
+ }
// avoids infinite recursion of numerals
if (self.operator != "-"
|| !(self.expression instanceof AST_Number