From a88cdfa4a674c251cfdac21043ca1d87fa28824c Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 12 May 2019 20:05:30 +0200 Subject: Finish implementing binary encoding --- dhall/build.rs | 5 +++-- dhall/src/phase/binary.rs | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'dhall') 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), UnionMap(&'a DupTreeMap>), + 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), } } } -- cgit v1.2.3