summaryrefslogtreecommitdiff
path: root/dhall_proc_macros/src
diff options
context:
space:
mode:
authorNadrieril2019-05-10 19:49:38 +0200
committerNadrieril2019-05-10 19:49:38 +0200
commita8e696f62f14296b94964adb1946d7e2b5ef5ebd (patch)
tree8ac9c17c4e0cf7470b047c46ac7042d1db1bb1e9 /dhall_proc_macros/src
parent36bcec6c91d3192b5c84c96af96961ff6b79f0f0 (diff)
Write a custom map type that allows duplicates
Diffstat (limited to 'dhall_proc_macros/src')
-rw-r--r--dhall_proc_macros/src/quote.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/dhall_proc_macros/src/quote.rs b/dhall_proc_macros/src/quote.rs
index 00bcd45..3dbfba9 100644
--- a/dhall_proc_macros/src/quote.rs
+++ b/dhall_proc_macros/src/quote.rs
@@ -161,15 +161,15 @@ fn quote_expr<N>(expr: &Expr<N, X>, ctx: &Context<Label, ()>) -> TokenStream {
}
fn quote_builtin(b: Builtin) -> TokenStream {
- format!("dhall_syntax::Builtin::{:?}", b).parse().unwrap()
+ format!("::dhall_syntax::Builtin::{:?}", b).parse().unwrap()
}
fn quote_const(c: Const) -> TokenStream {
- format!("dhall_syntax::Const::{:?}", c).parse().unwrap()
+ format!("::dhall_syntax::Const::{:?}", c).parse().unwrap()
}
fn quote_binop(b: BinOp) -> TokenStream {
- format!("dhall_syntax::BinOp::{:?}", b).parse().unwrap()
+ format!("::dhall_syntax::BinOp::{:?}", b).parse().unwrap()
}
fn quote_label(l: &Label) -> TokenStream {
@@ -178,7 +178,7 @@ fn quote_label(l: &Label) -> TokenStream {
}
fn rc(x: TokenStream) -> TokenStream {
- quote! { dhall_syntax::rc(#x) }
+ quote! { ::dhall_syntax::rc(#x) }
}
fn quote_opt<TS>(x: Option<TS>) -> TokenStream
@@ -204,11 +204,10 @@ where
{
let entries = m.into_iter().map(|(k, v)| {
let k = quote_label(&k);
- quote!(m.push((#k, #v));)
+ quote!(m.insert(#k, #v);)
});
quote! { {
- use std::vec::Vec;
- let mut m = Vec::new();
+ let mut m = ::dhall_syntax::map::DupTreeMap::new();
#( #entries )*
m
} }