From 70fd5428226bfc6c75314a987a643b8e7d82fb31 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Aug 2020 16:04:11 +0200 Subject: Introduce hir::Param We generally shouldn't expose TypeRef out of hir. So, let's just use a placehoder here. --- crates/hir/src/code_model.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 3254f316b..68ccedc60 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -673,8 +673,13 @@ impl Function { Some(SelfParam { func: self.id }) } - pub fn params(self, db: &dyn HirDatabase) -> Vec { - db.function_data(self.id).params.clone() + pub fn params(self, db: &dyn HirDatabase) -> Vec { + db.function_data(self.id) + .params + .iter() + .skip(if self.self_param(db).is_some() { 1 } else { 0 }) + .map(|_| Param { _ty: () }) + .collect() } pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool { @@ -707,6 +712,10 @@ pub struct SelfParam { func: FunctionId, } +pub struct Param { + _ty: (), +} + impl SelfParam { pub fn access(self, db: &dyn HirDatabase) -> Access { let func_data = db.function_data(self.func); -- cgit v1.2.3