summaryrefslogtreecommitdiff
path: root/dhall/src/lib.rs
diff options
context:
space:
mode:
authorNadrieril2020-12-07 15:24:36 +0000
committerNadrieril2020-12-07 19:34:39 +0000
commit922199ab322efa7b62bf4698cf5ed9e2d7a378c0 (patch)
treec66ecd3b0bb54fe6a31a83ab796df24c370ed265 /dhall/src/lib.rs
parentc1fe26d45c831eec015ad5c015236fce1928613a (diff)
Unify `skip_resolve_expr` with normal resolution
Diffstat (limited to '')
-rw-r--r--dhall/src/lib.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs
index 7f77334..c27b633 100644
--- a/dhall/src/lib.rs
+++ b/dhall/src/lib.rs
@@ -58,6 +58,11 @@ pub struct ToExprOptions {
}
impl Parsed {
+ /// Construct from an `Expr`. This `Expr` will have imports disabled.
+ pub fn from_expr_without_imports(e: Expr) -> Self {
+ Parsed(e, ImportLocation::dhall_code_without_imports())
+ }
+
pub fn parse_file(f: &Path) -> Result<Parsed, Error> {
parse::parse_file(f)
}
@@ -78,8 +83,11 @@ impl Parsed {
pub fn resolve<'cx>(self, cx: Ctxt<'cx>) -> Result<Resolved<'cx>, Error> {
resolve::resolve(cx, self)
}
- pub fn skip_resolve<'cx>(self) -> Result<Resolved<'cx>, Error> {
- resolve::skip_resolve(self)
+ pub fn skip_resolve<'cx>(
+ self,
+ cx: Ctxt<'cx>,
+ ) -> Result<Resolved<'cx>, Error> {
+ resolve::skip_resolve(cx, self)
}
/// Converts a value back to the corresponding AST expression.
@@ -122,6 +130,9 @@ impl<'cx> Typed<'cx> {
self.hir.to_expr(cx, ToExprOptions { alpha: false })
}
+ pub fn as_hir(&self) -> &Hir<'cx> {
+ &self.hir
+ }
pub fn ty(&self) -> &Type<'cx> {
&self.ty
}