mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Merge #5815
5815: Introduce hir::Param
r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
22d2e34bf3
1 changed files with 11 additions and 2 deletions
|
@ -673,8 +673,13 @@ impl Function {
|
|||
Some(SelfParam { func: self.id })
|
||||
}
|
||||
|
||||
pub fn params(self, db: &dyn HirDatabase) -> Vec<TypeRef> {
|
||||
db.function_data(self.id).params.clone()
|
||||
pub fn params(self, db: &dyn HirDatabase) -> Vec<Param> {
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue