diff options
author | Nadrieril | 2019-05-04 14:58:18 +0200 |
---|---|---|
committer | Nadrieril | 2019-05-04 14:58:18 +0200 |
commit | 1b1c34b90bb4bf3859b05b1da6db2dcb374996bb (patch) | |
tree | a344a360f8735a3f33d05c04568d9449efa7ba4c /dhall_syntax/src/printer.rs | |
parent | b6f57069b75febf1d312a98efcd6544c9db2fe59 (diff) |
Move `Note`s into the spine of the AST
Diffstat (limited to 'dhall_syntax/src/printer.rs')
-rw-r--r-- | dhall_syntax/src/printer.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/dhall_syntax/src/printer.rs b/dhall_syntax/src/printer.rs index 704000a..e3b180b 100644 --- a/dhall_syntax/src/printer.rs +++ b/dhall_syntax/src/printer.rs @@ -3,7 +3,7 @@ use itertools::Itertools; use std::fmt::{self, Display}; /// Generic instance that delegates to subexpressions -impl<SE: Display + Clone, N, E: Display> Display for ExprF<SE, Label, N, E> { +impl<SE: Display + Clone, E: Display> Display for ExprF<SE, Label, E> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { use crate::ExprF::*; match self { @@ -102,7 +102,6 @@ impl<SE: Display + Clone, N, E: Display> Display for ExprF<SE, Label, N, E> { f.write_str(" >")? } Embed(a) => a.fmt(f)?, - Note(_, b) => b.fmt(f)?, } Ok(()) } @@ -143,7 +142,7 @@ impl<S: Clone, A: Display + Clone> Expr<S, A> { fn fmt_phase( &self, f: &mut fmt::Formatter, - mut phase: PrintPhase, + phase: PrintPhase, ) -> Result<(), fmt::Error> { use crate::ExprF::*; use PrintPhase::*; @@ -170,10 +169,6 @@ impl<S: Clone, A: Display + Clone> Expr<S, A> { _ => false, }; - if needs_paren { - phase = Base; - } - // Annotate subexpressions with the appropriate phase, defaulting to Base let phased_self = match self.map_ref_simple(|e| PhasedExpr(e, Base)) { Pi(a, b, c) => { @@ -200,7 +195,6 @@ impl<S: Clone, A: Display + Clone> Expr<S, A> { ExprF::App(f, a) => ExprF::App(f.phase(Import), a.phase(Import)), Field(a, b) => Field(a.phase(Primitive), b), Projection(e, ls) => Projection(e.phase(Primitive), ls), - Note(n, b) => Note(n, b.phase(phase)), e => e, }; |