summaryrefslogtreecommitdiff
path: root/dhall/src/typecheck.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/typecheck.rs')
-rw-r--r--dhall/src/typecheck.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs
index becabbd..fe9f68c 100644
--- a/dhall/src/typecheck.rs
+++ b/dhall/src/typecheck.rs
@@ -17,40 +17,50 @@ impl Resolved {
}
}
impl Typed {
+ #[inline(always)]
fn as_expr(&self) -> &SubExpr<X, X> {
&self.0
}
+ #[inline(always)]
fn into_expr(self) -> SubExpr<X, X> {
self.0
}
+ #[inline(always)]
pub fn get_type<'a>(&'a self) -> Type<'a> {
self.1.reborrow()
}
}
impl Normalized {
+ #[inline(always)]
fn as_expr(&self) -> &SubExpr<X, X> {
&self.0
}
+ #[inline(always)]
fn into_expr(self) -> SubExpr<X, X> {
self.0
}
+ #[inline(always)]
pub fn get_type<'a>(&'a self) -> Type<'a> {
self.1.reborrow()
}
+ #[inline(always)]
fn into_type(self) -> Type<'static> {
crate::expr::Type(Cow::Owned(TypeInternal::Expr(Box::new(self))))
}
}
impl<'a> Type<'a> {
+ #[inline(always)]
fn into_owned(self) -> Type<'static> {
Type(Cow::Owned(self.0.into_owned()))
}
+ #[inline(always)]
fn reborrow<'b>(&'b self) -> Type<'b> {
match &self.0 {
Cow::Owned(x) => crate::expr::Type(Cow::Borrowed(x)),
Cow::Borrowed(x) => crate::expr::Type(Cow::Borrowed(x)),
}
}
+ #[inline(always)]
fn as_expr(&'a self) -> Result<&'a SubExpr<X, X>, TypeError<X>> {
use TypeInternal::*;
match self.0.as_ref() {
@@ -62,6 +72,7 @@ impl<'a> Type<'a> {
)),
}
}
+ #[inline(always)]
fn into_expr(self) -> Result<SubExpr<X, X>, TypeError<X>> {
use TypeInternal::*;
match self.0.into_owned() {
@@ -73,6 +84,7 @@ impl<'a> Type<'a> {
)),
}
}
+ #[inline(always)]
pub fn get_type<'b>(&'b self) -> Type<'b> {
use TypeInternal::*;
match self.0.as_ref() {