mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Introduce hir::Param
We generally shouldn't expose TypeRef out of hir. So, let's just use a placehoder here.
This commit is contained in:
parent
e8d266fa6d
commit
70fd542822
1 changed files with 11 additions and 2 deletions
|
@ -673,8 +673,13 @@ impl Function {
|
||||||
Some(SelfParam { func: self.id })
|
Some(SelfParam { func: self.id })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn params(self, db: &dyn HirDatabase) -> Vec<TypeRef> {
|
pub fn params(self, db: &dyn HirDatabase) -> Vec<Param> {
|
||||||
db.function_data(self.id).params.clone()
|
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 {
|
pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool {
|
||||||
|
@ -707,6 +712,10 @@ pub struct SelfParam {
|
||||||
func: FunctionId,
|
func: FunctionId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct Param {
|
||||||
|
_ty: (),
|
||||||
|
}
|
||||||
|
|
||||||
impl SelfParam {
|
impl SelfParam {
|
||||||
pub fn access(self, db: &dyn HirDatabase) -> Access {
|
pub fn access(self, db: &dyn HirDatabase) -> Access {
|
||||||
let func_data = db.function_data(self.func);
|
let func_data = db.function_data(self.func);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue