From 696efe66336a268054c475fab9fe6505bdfc7b60 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 4 Aug 2019 13:00:56 +0200 Subject: Add some new tests and implement import alternatives --- dhall_syntax/src/core/visitor.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'dhall_syntax/src/core/visitor.rs') diff --git a/dhall_syntax/src/core/visitor.rs b/dhall_syntax/src/core/visitor.rs index 1745fdb..b02544f 100644 --- a/dhall_syntax/src/core/visitor.rs +++ b/dhall_syntax/src/core/visitor.rs @@ -358,6 +358,31 @@ where } } +pub struct ResolveVisitor(pub F1); + +impl<'a, 'b, N, E, E2, Err, F1> + ExprFFallibleVisitor<'a, SubExpr, SubExpr, E, E2> + for &'b mut ResolveVisitor +where + N: Clone + 'a, + F1: FnMut(&E) -> Result, +{ + type Error = Err; + + fn visit_subexpr( + &mut self, + subexpr: &'a SubExpr, + ) -> Result, Self::Error> { + Ok(subexpr.rewrap( + subexpr + .as_ref() + .traverse_resolve_with_visitor(&mut **self)?, + )) + } + fn visit_embed(self, embed: &'a E) -> Result { + (self.0)(embed) + } +} pub struct NoteAbsurdVisitor; impl<'a, 'b, N, E> -- cgit v1.2.3