aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-29 20:53:03 +0800
committerGitHub <noreply@github.com>2017-03-29 20:53:03 +0800
commit2e41cd6394ad389080b446c20f519fc3920f81c7 (patch)
tree72ce7ca1887e388bf2a9c23d3bf2e41738daf002 /lib
parent09f77c7d4d37350102c36b270b553f45e706d0c8 (diff)
downloadtracifyjs-2e41cd6394ad389080b446c20f519fc3920f81c7.tar.gz
tracifyjs-2e41cd6394ad389080b446c20f519fc3920f81c7.zip
fix missing parentheses around NaN/Infinity shorthands (#1726)
fixes #1724 fixes #1725
Diffstat (limited to 'lib')
-rw-r--r--lib/output.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/output.js b/lib/output.js
index d71f6aac..c8c8739f 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -596,7 +596,9 @@ function OutputStream(options) {
var p = output.parent();
return p instanceof AST_PropAccess && p.expression === this
|| p instanceof AST_Call && p.expression === this
- || p instanceof AST_Unary && p.operator != "+" && p.operator != "-";
+ || p instanceof AST_Unary && p.operator != "+" && p.operator != "-"
+ || p instanceof AST_Binary && p.right === this
+ && (p.operator == "/" || p.operator == "%");
});
PARENS(AST_Seq, function(output){