Fix 1 - (1 - 1) (#418)

This commit is contained in:
강동윤 2019-09-18 16:05:36 +09:00
parent 7715c2626b
commit 5a47c7a15c

View File

@ -353,7 +353,7 @@ impl Fold<Expr> for Fixer {
| e @ Expr::Cond(..)
| e @ Expr::Arrow(..) => box e.wrap_with_paren(),
Expr::Bin(BinExpr { op: op_of_rhs, .. }) => {
if op_of_rhs.precedence() < expr.op.precedence() {
if op_of_rhs.precedence() <= expr.op.precedence() {
box expr.right.wrap_with_paren()
} else {
expr.right
@ -826,4 +826,6 @@ var store = global[SHARED] || (global[SHARED] = {});
"const myFilter = (arr, filter) => arr.filter(filter || ((x) => x));"
);
identical!(issue_418, "const a = 1 - (1 - 1)");
}