summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/binary
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/syntax/binary')
-rw-r--r--dhall/src/syntax/binary/decode.rs12
-rw-r--r--dhall/src/syntax/binary/encode.rs14
2 files changed, 14 insertions, 12 deletions
diff --git a/dhall/src/syntax/binary/decode.rs b/dhall/src/syntax/binary/decode.rs
index f452666..8b73e46 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::semantics::phase::DecodedExpr;
use crate::syntax;
use crate::syntax::{
- Expr, ExprF, FilePath, FilePrefix, Hash, ImportLocation, ImportMode,
+ Expr, ExprKind, FilePath, FilePrefix, Hash, ImportLocation, ImportMode,
Integer, InterpolatedText, Label, Natural, RawExpr, Scheme, Span, URL, V,
};
@@ -25,10 +25,10 @@ fn rc<E>(x: RawExpr<E>) -> Expr<E> {
fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
use cbor::Value::*;
use syntax::{BinOp, Builtin, Const};
- use ExprF::*;
+ use ExprKind::*;
Ok(rc(match data {
String(s) => match Builtin::parse(s) {
- Some(b) => ExprF::Builtin(b),
+ Some(b) => ExprKind::Builtin(b),
None => match s.as_str() {
"True" => BoolLit(true),
"False" => BoolLit(false),
@@ -123,7 +123,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
}
[U64(4), t] => {
let t = cbor_value_to_dhall(&t)?;
- EmptyListLit(rc(App(rc(ExprF::Builtin(Builtin::List)), t)))
+ EmptyListLit(rc(App(rc(ExprKind::Builtin(Builtin::List)), t)))
}
[U64(4), Null, rest @ ..] => {
let rest = rest
@@ -139,14 +139,14 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
// Old-style optional literals
[U64(5), t] => {
let t = cbor_value_to_dhall(&t)?;
- App(rc(ExprF::Builtin(Builtin::OptionalNone)), t)
+ App(rc(ExprKind::Builtin(Builtin::OptionalNone)), t)
}
[U64(5), t, x] => {
let x = cbor_value_to_dhall(&x)?;
let t = cbor_value_to_dhall(&t)?;
Annot(
rc(SomeLit(x)),
- rc(App(rc(ExprF::Builtin(Builtin::Optional)), t)),
+ rc(App(rc(ExprKind::Builtin(Builtin::Optional)), t)),
)
}
[U64(6), x, y] => {
diff --git a/dhall/src/syntax/binary/encode.rs b/dhall/src/syntax/binary/encode.rs
index c1e7c4c..25a545c 100644
--- a/dhall/src/syntax/binary/encode.rs
+++ b/dhall/src/syntax/binary/encode.rs
@@ -5,8 +5,8 @@ use crate::error::EncodeError;
use crate::syntax;
use crate::syntax::map::DupTreeMap;
use crate::syntax::{
- Expr, ExprF, FilePrefix, Hash, Import, ImportLocation, ImportMode, Label,
- Scheme, V,
+ Expr, ExprKind, FilePrefix, Hash, Import, ImportLocation, ImportMode,
+ Label, Scheme, V,
};
/// Warning: will fail if `expr` contains an `Embed` node.
@@ -46,7 +46,7 @@ where
use cbor::Value::{String, I64, U64};
use std::iter::once;
use syntax::Builtin;
- use syntax::ExprF::*;
+ use syntax::ExprKind::*;
use self::Serialize::{RecordMap, UnionMap};
fn expr<E>(x: &Expr<E>) -> self::Serialize<'_, E> {
@@ -110,7 +110,9 @@ where
SomeLit(x) => ser_seq!(ser; tag(5), null(), expr(x)),
EmptyListLit(x) => match x.as_ref() {
App(f, a) => match f.as_ref() {
- ExprF::Builtin(Builtin::List) => ser_seq!(ser; tag(4), expr(a)),
+ ExprKind::Builtin(Builtin::List) => {
+ ser_seq!(ser; tag(4), expr(a))
+ }
_ => ser_seq!(ser; tag(28), expr(x)),
},
_ => ser_seq!(ser; tag(28), expr(x)),
@@ -284,7 +286,7 @@ fn collect_nested_applications<'a, E>(
) -> (&'a Expr<E>, Vec<&'a Expr<E>>) {
fn go<'a, E>(e: &'a Expr<E>, vec: &mut Vec<&'a Expr<E>>) -> &'a Expr<E> {
match e.as_ref() {
- ExprF::App(f, a) => {
+ ExprKind::App(f, a) => {
vec.push(a);
go(f, vec)
}
@@ -306,7 +308,7 @@ fn collect_nested_lets<'a, E>(
vec: &mut Vec<LetBinding<'a, E>>,
) -> &'a Expr<E> {
match e.as_ref() {
- ExprF::Let(l, t, v, e) => {
+ ExprKind::Let(l, t, v, e) => {
vec.push((l, t, v));
go(e, vec)
}