summaryrefslogtreecommitdiff
path: root/dhall_generator
diff options
context:
space:
mode:
authorNadrieril2019-04-18 16:00:22 +0200
committerNadrieril2019-04-18 16:00:33 +0200
commitd8fb1cc0f5bdf6650424169b3bd841e611924760 (patch)
tree00fa2b45602db3086ed06f31858acd4a00e653ba /dhall_generator
parent22aa0081d314453bd1bb607384da3ed983dc4364 (diff)
parenta0458fa3824ac301c8d0c1d7091e10d1468cbf91 (diff)
Merge branch 'cleanup_map_mess'
Closes #83
Diffstat (limited to '')
-rw-r--r--dhall_generator/src/quote.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/dhall_generator/src/quote.rs b/dhall_generator/src/quote.rs
index c335666..400c12c 100644
--- a/dhall_generator/src/quote.rs
+++ b/dhall_generator/src/quote.rs
@@ -10,8 +10,8 @@ pub fn expr(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let expr: SubExpr<_, Import> = parse_expr(&input_str).unwrap().unnote();
let no_import =
|_: &Import| -> X { panic!("Don't use import in dhall::expr!()") };
- let expr = expr.as_ref().map_embed(&no_import);
- let output = quote_expr(&expr, &Context::new());
+ let expr = expr.map_embed(no_import);
+ let output = quote_expr(&expr.unroll(), &Context::new());
output.into()
}
@@ -20,8 +20,8 @@ pub fn subexpr(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let expr: SubExpr<_, Import> = parse_expr(&input_str).unwrap().unnote();
let no_import =
|_: &Import| -> X { panic!("Don't use import in dhall::subexpr!()") };
- let expr = expr.as_ref().map_embed(&no_import);
- let output = quote_subexpr(&dhall_core::rc(expr), &Context::new());
+ let expr = expr.map_embed(no_import);
+ let output = quote_subexpr(&expr, &Context::new());
output.into()
}
@@ -103,7 +103,7 @@ fn quote_subexpr(
ctx: &Context<Label, ()>,
) -> TokenStream {
use dhall_core::ExprF::*;
- match expr.as_ref().map_ref(
+ match expr.as_ref().map_ref_with_special_handling_of_binders(
|e| quote_subexpr(e, ctx),
|l, e| quote_subexpr(e, &ctx.insert(l.clone(), ())),
|_| unreachable!(),
@@ -138,7 +138,7 @@ fn quote_subexpr(
// to be of type SubExpr<_, _>.
fn quote_expr(expr: &Expr<X, X>, ctx: &Context<Label, ()>) -> TokenStream {
use dhall_core::ExprF::*;
- match expr.map_ref(
+ match expr.map_ref_with_special_handling_of_binders(
|e| quote_subexpr(e, ctx),
|l, e| quote_subexpr(e, &ctx.insert(l.clone(), ())),
|_| unreachable!(),