diff options
Diffstat (limited to 'src/ast/hir.rs')
-rw-r--r-- | src/ast/hir.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ast/hir.rs b/src/ast/hir.rs index 9db6919f6f53..6859174a2dd0 100644 --- a/src/ast/hir.rs +++ b/src/ast/hir.rs @@ -222,6 +222,12 @@ pub enum Decl<'a, T> { } impl<'a, T> Decl<'a, T> { + pub fn type_(&self) -> &T { + match self { + Decl::Fun { type_, .. } => type_, + } + } + pub fn traverse_type<F, U, E>(self, f: F) -> Result<Decl<'a, U>, E> where F: Fn(T) -> Result<U, E> + Clone, |