summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/resolve/env.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/semantics/resolve/env.rs')
-rw-r--r--dhall/src/semantics/resolve/env.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/dhall/src/semantics/resolve/env.rs b/dhall/src/semantics/resolve/env.rs
index 0d1952b..bde99d1 100644
--- a/dhall/src/semantics/resolve/env.rs
+++ b/dhall/src/semantics/resolve/env.rs
@@ -95,9 +95,12 @@ impl<'cx> ImportEnv<'cx> {
Some(expr)
}
- /// Invariant: the import must have been fetched.
- pub fn check_hash(&self, import: ImportId<'cx>) -> Result<(), Error> {
- check_hash(self.cx(), import)
+ pub fn check_hash(
+ &self,
+ import: ImportId<'cx>,
+ result: ImportResultId<'cx>,
+ ) -> Result<(), Error> {
+ check_hash(self.cx(), import, result)
}
pub fn write_to_mem_cache(
@@ -108,12 +111,14 @@ impl<'cx> ImportEnv<'cx> {
self.mem_cache.insert(location, result);
}
- /// Invariant: the import must have been fetched.
- pub fn write_to_disk_cache(&self, import: ImportId<'cx>) {
- let import = &self.cx()[import];
+ pub fn write_to_disk_cache(
+ &self,
+ hash: &Option<Hash>,
+ result: ImportResultId<'cx>,
+ ) {
if let Some(disk_cache) = self.disk_cache.as_ref() {
- if let Some(hash) = &import.import.hash {
- let expr = import.unwrap_result();
+ if let Some(hash) = hash {
+ let expr = &self.cx()[result];
let _ = disk_cache.insert(self.cx(), hash, expr);
}
}