Use single source of truth for expr precedence

Introduce a new unified type that holds the expression precedence for
both AST and HIR nodes.
This commit is contained in:
Esteban Küber
2018-01-10 11:40:16 -08:00
parent 09efaaf076
commit afe8d13a66
6 changed files with 248 additions and 115 deletions

View File

@@ -1839,7 +1839,7 @@ impl<'a> State<'a> {
}
pub fn print_expr_maybe_paren(&mut self, expr: &ast::Expr, prec: i8) -> io::Result<()> {
let needs_par = parser::expr_precedence(expr) < prec;
let needs_par = expr.precedence().order() < prec;
if needs_par {
self.popen()?;
}