summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2020-02-18 19:08:53 +0000
committerNadrieril2020-02-18 19:08:53 +0000
commita3990858840a737d7831be45953b38bd67361fb7 (patch)
treebca528f60e5dfd3c80470f9526e96fc422d3c6ba
parent50a9dc4b9af19a35a983fe17108453d1d82d80ed (diff)
Discard import headers while we don't use them
-rw-r--r--dhall/src/error/mod.rs4
-rw-r--r--dhall/src/semantics/resolve/hir.rs10
-rw-r--r--dhall/src/semantics/resolve/resolve.rs9
3 files changed, 10 insertions, 13 deletions
diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs
index 51bd549..b8f2fca 100644
--- a/dhall/src/error/mod.rs
+++ b/dhall/src/error/mod.rs
@@ -27,8 +27,8 @@ pub(crate) enum ErrorKind {
#[derive(Debug)]
pub(crate) enum ImportError {
- UnexpectedImport(Import<Hir>),
- ImportCycle(ImportStack, Import<Hir>),
+ UnexpectedImport(Import<()>),
+ ImportCycle(ImportStack, Import<()>),
}
#[derive(Debug)]
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())