summaryrefslogtreecommitdiff
path: root/dhall_generator
diff options
context:
space:
mode:
authorNadrieril2019-03-21 16:36:46 +0100
committerNadrieril2019-03-21 16:36:46 +0100
commit845abbb0404ac15cefeca8b6ac32d9b3f93e5987 (patch)
tree74a363bafddc951ae08fc722ab8d2f1891e57f28 /dhall_generator
parent427c5e55a6e6768b22c3e7ad40594d451ac024e7 (diff)
Represent Optional literals more faithfully
Diffstat (limited to 'dhall_generator')
-rw-r--r--dhall_generator/src/lib.rs22
1 files changed, 7 insertions, 15 deletions
diff --git a/dhall_generator/src/lib.rs b/dhall_generator/src/lib.rs
index a246818..328bc3e 100644
--- a/dhall_generator/src/lib.rs
+++ b/dhall_generator/src/lib.rs
@@ -63,10 +63,13 @@ fn dhall_to_tokenstream(
NaturalLit(n) => {
quote! { NaturalLit(#n) }
}
- OptionalLit(t, e) => {
- let t = option_to_tokenstream(t, ctx);
- let e = option_to_tokenstream(e, ctx);
- quote! { OptionalLit(#t, #e) }
+ EmptyOptionalLit(x) => {
+ let x = dhall_to_tokenstream_bx(x, ctx);
+ quote! { EmptyOptionalLit(#x) }
+ }
+ NEOptionalLit(x) => {
+ let x = dhall_to_tokenstream_bx(x, ctx);
+ quote! { NEOptionalLit(#x) }
}
EmptyListLit(t) => {
let t = dhall_to_tokenstream_bx(t, ctx);
@@ -153,17 +156,6 @@ fn map_to_tokenstream(
} }
}
-fn option_to_tokenstream(
- e: &Option<DhallExpr>,
- ctx: &Context<Label, ()>,
-) -> TokenStream {
- let e = e.as_ref().map(|x| dhall_to_tokenstream_bx(x, ctx));
- match e {
- Some(x) => quote! { Some(#x) },
- None => quote! { None },
- }
-}
-
fn vec_to_tokenstream(
e: &Vec<DhallExpr>,
ctx: &Context<Label, ()>,