diff options
author | Nadrieril | 2020-12-07 14:15:43 +0000 |
---|---|---|
committer | Nadrieril | 2020-12-07 19:34:39 +0000 |
commit | 8c5b3ff15f2125e9d731fc199e194e1993c36b37 (patch) | |
tree | a88ac770aa3e7605feed8381877f290a2b64cd43 /dhall/src/ctxt.rs | |
parent | 3c522217b7445c6df9e170d830f485086ad7e062 (diff) |
Thread cx everywhere else imports are read
Diffstat (limited to 'dhall/src/ctxt.rs')
-rw-r--r-- | dhall/src/ctxt.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/dhall/src/ctxt.rs b/dhall/src/ctxt.rs index 8bdf99d..3809bc9 100644 --- a/dhall/src/ctxt.rs +++ b/dhall/src/ctxt.rs @@ -83,6 +83,12 @@ impl<'cx> StoredImport<'cx> { let res = self.get_resultid()?; Some(&self.cx[res]) } + /// Get the result of fetching this import. Panicx if the result has not yet been + /// fetched. + pub fn unwrap_result(&self) -> &'cx Typed<'cx> { + self.get_result() + .expect("imports should all have been resolved at this stage") + } /// Store the result of fetching this import. pub fn set_result(&self, res: Typed<'cx>) -> ImportResultId<'cx> { let res = self.cx.push_import_result(res); |