summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/binary
diff options
context:
space:
mode:
authorNadrieril2020-04-06 22:24:15 +0100
committerNadrieril2020-04-06 22:26:08 +0100
commit56efd2ac39149d8652bd625fbf0679c10823b137 (patch)
tree4d9e58ad86ea37dca7a2232ab475791669000684 /dhall/src/syntax/binary
parent2cf9169e1a21e1196e0265847abcfa904e2d45a3 (diff)
Move BinOp and Builtin definitions in the relevant module
Diffstat (limited to 'dhall/src/syntax/binary')
-rw-r--r--dhall/src/syntax/binary/decode.rs4
-rw-r--r--dhall/src/syntax/binary/encode.rs8
2 files changed, 7 insertions, 5 deletions
diff --git a/dhall/src/syntax/binary/decode.rs b/dhall/src/syntax/binary/decode.rs
index f062089..195bd0a 100644
--- a/dhall/src/syntax/binary/decode.rs
+++ b/dhall/src/syntax/binary/decode.rs
@@ -25,8 +25,10 @@ fn rc(x: UnspannedExpr) -> Expr {
}
fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
+ use crate::builtins::Builtin;
+ use crate::operations::BinOp;
use cbor::Value::*;
- use syntax::{BinOp, Builtin, Const};
+ use syntax::Const;
use ExprKind::*;
use OpKind::*;
Ok(rc(match data {
diff --git a/dhall/src/syntax/binary/encode.rs b/dhall/src/syntax/binary/encode.rs
index cef2af8..913dd67 100644
--- a/dhall/src/syntax/binary/encode.rs
+++ b/dhall/src/syntax/binary/encode.rs
@@ -2,8 +2,9 @@ use serde_cbor::value::value as cbor;
use std::collections::BTreeMap;
use std::vec;
+use crate::builtins::Builtin;
use crate::error::EncodeError;
-use crate::operations::OpKind;
+use crate::operations::{BinOp, OpKind};
use crate::syntax;
use crate::syntax::map::DupTreeMap;
use crate::syntax::{
@@ -47,7 +48,6 @@ where
{
use cbor::Value::{String, I64, U64};
use std::iter::once;
- use syntax::Builtin;
use syntax::ExprKind::*;
use syntax::NumKind::*;
use OpKind::*;
@@ -116,7 +116,7 @@ where
SomeLit(x) => ser_seq!(ser; tag(5), null(), expr(x)),
EmptyListLit(x) => match x.as_ref() {
Op(App(f, a)) => match f.as_ref() {
- ExprKind::Builtin(Builtin::List) => {
+ ExprKind::Builtin(self::Builtin::List) => {
ser_seq!(ser; tag(4), expr(a))
}
_ => ser_seq!(ser; tag(28), expr(x)),
@@ -138,7 +138,7 @@ where
UnionType(map) => ser_seq!(ser; tag(11), UnionMap(map)),
Op(Field(x, l)) => ser_seq!(ser; tag(9), expr(x), label(l)),
Op(BinOp(op, x, y)) => {
- use syntax::BinOp::*;
+ use self::BinOp::*;
let op = match op {
BoolOr => 0,
BoolAnd => 1,