diff options
Diffstat (limited to 'dhall/src/semantics/resolve/env.rs')
-rw-r--r-- | dhall/src/semantics/resolve/env.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/dhall/src/semantics/resolve/env.rs b/dhall/src/semantics/resolve/env.rs index fe8c178..d7ff0ae 100644 --- a/dhall/src/semantics/resolve/env.rs +++ b/dhall/src/semantics/resolve/env.rs @@ -5,24 +5,24 @@ use crate::semantics::{AlphaVar, ImportLocation, TypedHir, VarEnv}; use crate::syntax::{Label, V}; /// Environment for resolving names. -#[derive(Debug, Clone)] -pub(crate) struct NameEnv { +#[derive(Debug, Clone, Default)] +pub struct NameEnv { names: Vec<Label>, } -pub(crate) type ImportCache = HashMap<ImportLocation, TypedHir>; -pub(crate) type ImportStack = Vec<ImportLocation>; +pub type ImportCache = HashMap<ImportLocation, TypedHir>; +pub type ImportStack = Vec<ImportLocation>; /// Environment for resolving imports -#[derive(Debug, Clone)] -pub(crate) struct ImportEnv { +#[derive(Debug, Clone, Default)] +pub struct ImportEnv { cache: ImportCache, stack: ImportStack, } impl NameEnv { pub fn new() -> Self { - NameEnv { names: Vec::new() } + NameEnv::default() } pub fn as_varenv(&self) -> VarEnv { VarEnv::from_size(self.names.len()) @@ -66,10 +66,7 @@ impl NameEnv { impl ImportEnv { pub fn new() -> Self { - ImportEnv { - cache: HashMap::new(), - stack: Vec::new(), - } + ImportEnv::default() } pub fn handle_import( |