From 1afeea85ffa65d0b9c6cc784542ba1716cb721db Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Tue, 5 Mar 2024 16:01:01 +0100 Subject: [PATCH] Add `fn parent_fn()` accessors for `hir::Param` & `hir::SelfParam` --- crates/hir/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 4872c47c31d..ffdf169bbb5 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2108,6 +2108,10 @@ pub struct Param { } impl Param { + pub fn parent_fn(&self) -> Function { + self.func + } + pub fn ty(&self) -> &Type { &self.ty } @@ -2172,6 +2176,10 @@ impl SelfParam { .map(|value| InFile { file_id, value }) } + pub fn parent_fn(&self) -> Function { + Function::from(self.func) + } + pub fn ty(&self, db: &dyn HirDatabase) -> Type { let substs = TyBuilder::placeholder_subst(db, self.func); let callable_sig =