From a3990858840a737d7831be45953b38bd67361fb7 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 18 Feb 2020 19:08:53 +0000 Subject: Discard import headers while we don't use them --- dhall/src/semantics/resolve/hir.rs | 10 +--------- dhall/src/semantics/resolve/resolve.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'dhall/src/semantics/resolve') 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(&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; +// 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()) -- cgit v1.2.3