summaryrefslogtreecommitdiff
path: root/dhall/src/semantics
diff options
context:
space:
mode:
authorNadrieril2020-02-18 19:08:53 +0000
committerNadrieril2020-02-18 19:08:53 +0000
commita3990858840a737d7831be45953b38bd67361fb7 (patch)
treebca528f60e5dfd3c80470f9526e96fc422d3c6ba /dhall/src/semantics
parent50a9dc4b9af19a35a983fe17108453d1d82d80ed (diff)
Discard import headers while we don't use them
Diffstat (limited to '')
-rw-r--r--dhall/src/semantics/resolve/hir.rs10
-rw-r--r--dhall/src/semantics/resolve/resolve.rs9
2 files changed, 8 insertions, 11 deletions
diff --git a/dhall/src/semantics/resolve/hir.rs b/dhall/src/semantics/resolve/hir.rs
index d0bec5a..73fc371 100644
--- a/dhall/src/semantics/resolve/hir.rs
+++ b/dhall/src/semantics/resolve/hir.rs
@@ -9,7 +9,7 @@ pub struct AlphaVar {
idx: usize,
}
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum HirKind {
/// A resolved variable (i.e. a DeBruijn index)
Var(AlphaVar),
@@ -128,11 +128,3 @@ impl std::cmp::PartialEq for Hir {
}
}
impl std::cmp::Eq for Hir {}
-impl std::hash::Hash for Hir {
- fn hash<H>(&self, state: &mut H)
- where
- H: std::hash::Hasher,
- {
- self.kind.hash(state)
- }
-}
diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs
index 22fb1a0..23d4c3d 100644
--- a/dhall/src/semantics/resolve/resolve.rs
+++ b/dhall/src/semantics/resolve/resolve.rs
@@ -8,7 +8,8 @@ use crate::syntax;
use crate::syntax::{BinOp, Expr, ExprKind, FilePath, ImportLocation, URL};
use crate::{Parsed, ParsedExpr, Resolved};
-pub(crate) type Import = syntax::Import<Hir>;
+// TODO: evaluate import headers
+pub(crate) type Import = syntax::Import<()>;
/// A root from which to resolve relative imports.
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -120,7 +121,11 @@ fn traverse_resolve_expr(
Ok::<_, Error>(hir)
})?;
let kind = match kind {
- ExprKind::Import(import) => f(import)?.kind().clone(),
+ ExprKind::Import(import) => {
+ // TODO: evaluate import headers
+ let import = import.traverse_ref(|_| Ok::<_, Error>(()))?;
+ f(import)?.kind().clone()
+ }
kind => HirKind::Expr(kind),
};
Hir::new(kind, expr.span())