diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-08-19 15:05:22 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-19 15:05:22 +0100 |
commit | 22d2e34bf3c189cacaeee66a1dae2ac08e6cf166 (patch) | |
tree | 3268a6ff56b652188ab175129ce7d9fed552ad01 /crates/hir | |
parent | e8d266fa6dd7ee883d1bba52eb6a37c5e473978f (diff) | |
parent | 70fd5428226bfc6c75314a987a643b8e7d82fb31 (diff) |
Merge #5815
5815: Introduce hir::Param
r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/code_model.rs | 13 |
1 files changed, 11 insertions, 2 deletions
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 { | |||
673 | Some(SelfParam { func: self.id }) | 673 | Some(SelfParam { func: self.id }) |
674 | } | 674 | } |
675 | 675 | ||
676 | pub fn params(self, db: &dyn HirDatabase) -> Vec<TypeRef> { | 676 | pub fn params(self, db: &dyn HirDatabase) -> Vec<Param> { |
677 | db.function_data(self.id).params.clone() | 677 | db.function_data(self.id) |
678 | .params | ||
679 | .iter() | ||
680 | .skip(if self.self_param(db).is_some() { 1 } else { 0 }) | ||
681 | .map(|_| Param { _ty: () }) | ||
682 | .collect() | ||
678 | } | 683 | } |
679 | 684 | ||
680 | pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool { | 685 | pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool { |
@@ -707,6 +712,10 @@ pub struct SelfParam { | |||
707 | func: FunctionId, | 712 | func: FunctionId, |
708 | } | 713 | } |
709 | 714 | ||
715 | pub struct Param { | ||
716 | _ty: (), | ||
717 | } | ||
718 | |||
710 | impl SelfParam { | 719 | impl SelfParam { |
711 | pub fn access(self, db: &dyn HirDatabase) -> Access { | 720 | pub fn access(self, db: &dyn HirDatabase) -> Access { |
712 | let func_data = db.function_data(self.func); | 721 | let func_data = db.function_data(self.func); |