From 2f5c45fd2f712f7befe6f7c92b62dc76d5f77538 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 13 Mar 2020 16:50:49 +0000 Subject: Rename LitKind to NumKind --- dhall/src/syntax/binary/decode.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'dhall/src/syntax/binary/decode.rs') diff --git a/dhall/src/syntax/binary/decode.rs b/dhall/src/syntax/binary/decode.rs index 2ecd7e0..05d5921 100644 --- a/dhall/src/syntax/binary/decode.rs +++ b/dhall/src/syntax/binary/decode.rs @@ -6,7 +6,7 @@ use crate::error::DecodeError; use crate::syntax; use crate::syntax::{ Expr, ExprKind, FilePath, FilePrefix, Hash, ImportMode, ImportTarget, - Integer, InterpolatedText, Label, LitKind, Natural, Scheme, Span, + Integer, InterpolatedText, Label, Natural, NumKind, Scheme, Span, UnspannedExpr, URL, V, }; use crate::DecodedExpr; @@ -31,8 +31,8 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result { String(s) => match Builtin::parse(s) { Some(b) => ExprKind::Builtin(b), None => match s.as_str() { - "True" => Lit(LitKind::Bool(true)), - "False" => Lit(LitKind::Bool(false)), + "True" => Num(NumKind::Bool(true)), + "False" => Num(NumKind::Bool(false)), "Type" => Const(Const::Type), "Kind" => Const(Const::Kind), "Sort" => Const(Const::Sort), @@ -44,8 +44,8 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result { }, }, U64(n) => Var(V(Label::from("_"), *n as usize)), - F64(x) => Lit(LitKind::Double((*x).into())), - Bool(b) => Lit(LitKind::Bool(*b)), + F64(x) => Num(NumKind::Double((*x).into())), + Bool(b) => Num(NumKind::Bool(*b)), Array(vec) => match vec.as_slice() { [String(l), U64(n)] => { if l.as_str() == "_" { @@ -224,9 +224,9 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result { let z = cbor_value_to_dhall(&z)?; BoolIf(x, y, z) } - [U64(15), U64(x)] => Lit(LitKind::Natural(*x as Natural)), - [U64(16), U64(x)] => Lit(LitKind::Integer(*x as Integer)), - [U64(16), I64(x)] => Lit(LitKind::Integer(*x as Integer)), + [U64(15), U64(x)] => Num(NumKind::Natural(*x as Natural)), + [U64(16), U64(x)] => Num(NumKind::Integer(*x as Integer)), + [U64(16), I64(x)] => Num(NumKind::Integer(*x as Integer)), [U64(18), String(first), rest @ ..] => { TextLit(InterpolatedText::from(( first.clone(), -- cgit v1.2.3 From 35db1b4b54dba8b0cafe661329e0099dfabd8073 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 13 Mar 2020 17:04:47 +0000 Subject: Remove top-level Expr aliases --- dhall/src/syntax/binary/decode.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dhall/src/syntax/binary/decode.rs') diff --git a/dhall/src/syntax/binary/decode.rs b/dhall/src/syntax/binary/decode.rs index 05d5921..0fd358e 100644 --- a/dhall/src/syntax/binary/decode.rs +++ b/dhall/src/syntax/binary/decode.rs @@ -9,7 +9,7 @@ use crate::syntax::{ Integer, InterpolatedText, Label, Natural, NumKind, Scheme, Span, UnspannedExpr, URL, V, }; -use crate::DecodedExpr; +type DecodedExpr = Expr; pub(crate) fn decode(data: &[u8]) -> Result { match serde_cbor::de::from_slice(data) { -- cgit v1.2.3 From 7848c8e8d3147ebe428290558aa6c0efcbf59ee5 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 18 Mar 2020 18:58:51 +0000 Subject: Brutally make all of dhall pub --- dhall/src/syntax/binary/decode.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dhall/src/syntax/binary/decode.rs') diff --git a/dhall/src/syntax/binary/decode.rs b/dhall/src/syntax/binary/decode.rs index 0fd358e..3c93419 100644 --- a/dhall/src/syntax/binary/decode.rs +++ b/dhall/src/syntax/binary/decode.rs @@ -11,7 +11,7 @@ use crate::syntax::{ }; type DecodedExpr = Expr; -pub(crate) fn decode(data: &[u8]) -> Result { +pub fn decode(data: &[u8]) -> Result { match serde_cbor::de::from_slice(data) { Ok(v) => cbor_value_to_dhall(&v), Err(e) => Err(DecodeError::CBORError(e)), -- cgit v1.2.3