summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorNadrieril2019-05-12 20:05:30 +0200
committerNadrieril2019-05-12 20:05:30 +0200
commita88cdfa4a674c251cfdac21043ca1d87fa28824c (patch)
treed0bd20993cbe6158e8b7ee2f1963adaab824fe5c /dhall
parentaac3a50ec2e7fd31e4264e3c87b9500ad6dc9beb (diff)
Finish implementing binary encoding
Diffstat (limited to 'dhall')
-rw-r--r--dhall/build.rs5
-rw-r--r--dhall/src/phase/binary.rs14
2 files changed, 11 insertions, 8 deletions
diff --git a/dhall/build.rs b/dhall/build.rs
index d28239d..46bb3a4 100644
--- a/dhall/build.rs
+++ b/dhall/build.rs
@@ -111,10 +111,11 @@ fn main() -> std::io::Result<()> {
path.starts_with("failure/")
// Too slow in debug mode
|| path == "success/largeExpression"
- // Fails binary encoding
+ // Too much of a pain to implement; shouldn't make a difference
+ // since lets disappear on normalization.
|| path == "success/multilet"
+ // See https://github.com/pyfisch/cbor/issues/109
|| path == "success/double"
- || path == "success/unit/import/parenthesizeUsing"
},
)?;
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs
index a3ab5de..96eaa6c 100644
--- a/dhall/src/phase/binary.rs
+++ b/dhall/src/phase/binary.rs
@@ -380,6 +380,7 @@ enum Serialize<'a> {
CBOR(cbor::Value),
RecordMap(&'a DupTreeMap<Label, ParsedSubExpr>),
UnionMap(&'a DupTreeMap<Label, Option<ParsedSubExpr>>),
+ Import(&'a Import),
}
macro_rules! count {
@@ -564,12 +565,12 @@ where
ImportLocation::Remote(url) => {
match &url.headers {
None => ser_seq.serialize_element(&Null)?,
- Some(_x) => unimplemented!(),
- // match cbor_value_to_dhall(&x)?.as_ref() {
- // Embed(import) => Some(Box::new(
- // import.location_hashed.clone(),
- // )),
- // }
+ Some(location_hashed) => ser_seq.serialize_element(
+ &self::Serialize::Import(&Import {
+ mode: ImportMode::Code,
+ location_hashed: location_hashed.as_ref().clone(),
+ }),
+ )?,
};
ser_seq.serialize_element(&url.authority)?;
for p in &url.path {
@@ -616,6 +617,7 @@ impl<'a> serde::ser::Serialize for Serialize<'a> {
(cbor::Value::String(k.into()), v)
}))
}
+ Serialize::Import(import) => serialize_import(ser, import),
}
}
}