Binary ops should add parenthesis to each side

Otherwise, we get (1 + 2) * 3 looking like 1 + 2 * 3
This commit is contained in:
Garming Sam
2015-08-06 18:43:02 +12:00
parent a5d33d8911
commit c67a34b9e5

View File

@@ -1670,10 +1670,10 @@ impl<'a> State<'a> {
op: ast::BinOp,
lhs: &ast::Expr,
rhs: &ast::Expr) -> io::Result<()> {
try!(self.print_expr(lhs));
try!(self.print_expr_maybe_paren(lhs));
try!(space(&mut self.s));
try!(self.word_space(ast_util::binop_to_string(op.node)));
self.print_expr(rhs)
self.print_expr_maybe_paren(rhs)
}
fn print_expr_unary(&mut self,