summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/resolve
diff options
context:
space:
mode:
authorNadrieril2020-04-06 17:19:31 +0100
committerNadrieril2020-04-06 17:19:31 +0100
commit08e1d8ece4314b56d64fa08595c2e043b97896d1 (patch)
tree22d9fcf951d7e6e86d33e8e1e89465b0e61381c3 /dhall/src/semantics/resolve
parentd35cb130d80d628807a4247ddf84a8d0230c87ab (diff)
Split off operations from main expr enum
Diffstat (limited to 'dhall/src/semantics/resolve')
-rw-r--r--dhall/src/semantics/resolve/resolve.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs
index 6e50fa6..3e0022f 100644
--- a/dhall/src/semantics/resolve/resolve.rs
+++ b/dhall/src/semantics/resolve/resolve.rs
@@ -11,7 +11,7 @@ use crate::syntax;
use crate::syntax::map::DupTreeMap;
use crate::syntax::{
BinOp, Builtin, Expr, ExprKind, FilePath, FilePrefix, Hash, ImportMode,
- ImportTarget, Span, UnspannedExpr, URL,
+ ImportTarget, OpKind, Span, UnspannedExpr, URL,
};
use crate::{Parsed, Resolved};
@@ -179,12 +179,13 @@ impl ImportLocation {
};
let asloc_ty = make_aslocation_uniontype();
- let expr = mkexpr(ExprKind::Field(asloc_ty, field_name.into()));
+ let expr =
+ mkexpr(ExprKind::Op(OpKind::Field(asloc_ty, field_name.into())));
match arg {
- Some(arg) => mkexpr(ExprKind::App(
+ Some(arg) => mkexpr(ExprKind::Op(OpKind::App(
expr,
mkexpr(ExprKind::TextLit(arg.into())),
- )),
+ ))),
None => expr,
}
}
@@ -261,21 +262,21 @@ fn resolve_one_import(
/// Desugar the first level of the expression.
fn desugar(expr: &Expr) -> Cow<'_, Expr> {
match expr.kind() {
- ExprKind::Completion(ty, compl) => {
+ ExprKind::Op(OpKind::Completion(ty, compl)) => {
let ty_field_default = Expr::new(
- ExprKind::Field(ty.clone(), "default".into()),
+ ExprKind::Op(OpKind::Field(ty.clone(), "default".into())),
expr.span(),
);
let merged = Expr::new(
- ExprKind::BinOp(
+ ExprKind::Op(OpKind::BinOp(
BinOp::RightBiasedRecordMerge,
ty_field_default,
compl.clone(),
- ),
+ )),
expr.span(),
);
let ty_field_type = Expr::new(
- ExprKind::Field(ty.clone(), "Type".into()),
+ ExprKind::Op(OpKind::Field(ty.clone(), "Type".into())),
expr.span(),
);
Cow::Owned(Expr::new(
@@ -304,7 +305,7 @@ fn traverse_resolve_expr(
.format(),
)?,
},
- ExprKind::BinOp(BinOp::ImportAlt, l, r) => {
+ ExprKind::Op(OpKind::BinOp(BinOp::ImportAlt, l, r)) => {
match traverse_resolve_expr(name_env, l, f) {
Ok(l) => l,
Err(_) => {