From c785b7c0c6cd8b3b1cc15eb79caf982a757020ba Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 6 Dec 2020 23:55:21 +0000 Subject: Thread cx through normalization --- dhall/src/semantics/resolve/env.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'dhall/src/semantics/resolve/env.rs') 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) -> Option { + pub fn get_from_disk_cache( + &self, + hash: &Option, + ) -> Option> { 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, expr: &Typed) { + pub fn write_to_disk_cache(&self, hash: &Option, 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, - ) -> Result { + do_resolve: impl FnOnce(&mut Self) -> Result, Error>, + ) -> Result, Error> { if self.stack.contains(&location) { return Err( ImportError::ImportCycle(self.stack.clone(), location).into() -- cgit v1.2.3