about summary refs log tree commit diff
path: root/users/glittershark/achilles/src/ast/hir.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/glittershark/achilles/src/ast/hir.rs')
-rw-r--r--users/glittershark/achilles/src/ast/hir.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/users/glittershark/achilles/src/ast/hir.rs b/users/glittershark/achilles/src/ast/hir.rs
index 0212b3dbcdbb..691b9607e7e6 100644
--- a/users/glittershark/achilles/src/ast/hir.rs
+++ b/users/glittershark/achilles/src/ast/hir.rs
@@ -228,6 +228,13 @@ pub enum Decl<'a, T> {
 }
 
 impl<'a, T> Decl<'a, T> {
+    pub fn name(&self) -> &Ident<'a> {
+        match self {
+            Decl::Fun { name, .. } => name,
+            Decl::Extern { name, .. } => name,
+        }
+    }
+
     pub fn type_(&self) -> Option<&T> {
         match self {
             Decl::Fun { type_, .. } => Some(type_),