From 8c5b3ff15f2125e9d731fc199e194e1993c36b37 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 7 Dec 2020 14:15:43 +0000 Subject: Thread cx everywhere else imports are read --- dhall/src/ctxt.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'dhall/src/ctxt.rs') 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); -- cgit v1.2.3