diff options
author | Nadrieril | 2020-12-06 23:55:21 +0000 |
---|---|---|
committer | Nadrieril | 2020-12-07 19:34:38 +0000 |
commit | c785b7c0c6cd8b3b1cc15eb79caf982a757020ba (patch) | |
tree | 6d38e68385814073b8b22ee8a8956435546892dc /dhall/src/semantics/resolve/env.rs | |
parent | 6287b7a7f9e421877ee13fefa586395fec844c99 (diff) |
Thread cx through normalization
Diffstat (limited to 'dhall/src/semantics/resolve/env.rs')
-rw-r--r-- | dhall/src/semantics/resolve/env.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/dhall/src/semantics/resolve/env.rs b/dhall/src/semantics/resolve/env.rs index 82f21e8..2b998f8 100644 --- a/dhall/src/semantics/resolve/env.rs +++ b/dhall/src/semantics/resolve/env.rs @@ -86,9 +86,12 @@ impl<'cx> ImportEnv<'cx> { Some(*self.mem_cache.get(location)?) } - pub fn get_from_disk_cache(&self, hash: &Option<Hash>) -> Option<Typed> { + pub fn get_from_disk_cache( + &self, + hash: &Option<Hash>, + ) -> Option<Typed<'cx>> { let hash = hash.as_ref()?; - let expr = self.disk_cache.as_ref()?.get(hash).ok()?; + let expr = self.disk_cache.as_ref()?.get(self.cx(), hash).ok()?; Some(expr) } @@ -100,7 +103,7 @@ impl<'cx> ImportEnv<'cx> { self.mem_cache.insert(location, result); } - pub fn write_to_disk_cache(&self, hash: &Option<Hash>, expr: &Typed) { + pub fn write_to_disk_cache(&self, hash: &Option<Hash>, expr: &Typed<'cx>) { if let Some(disk_cache) = self.disk_cache.as_ref() { if let Some(hash) = hash { let _ = disk_cache.insert(hash, &expr); @@ -111,8 +114,8 @@ impl<'cx> ImportEnv<'cx> { pub fn with_cycle_detection( &mut self, location: ImportLocation, - do_resolve: impl FnOnce(&mut Self) -> Result<Typed, Error>, - ) -> Result<Typed, Error> { + do_resolve: impl FnOnce(&mut Self) -> Result<Typed<'cx>, Error>, + ) -> Result<Typed<'cx>, Error> { if self.stack.contains(&location) { return Err( ImportError::ImportCycle(self.stack.clone(), location).into() |