5815: Introduce hir::Param
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-08-19 14:05:22 +00:00 committed by GitHub
commit 22d2e34bf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);