Add back Param struct
This commit is contained in:
parent
c6ddb90714
commit
04fc937700
@ -708,7 +708,7 @@ impl Function {
|
|||||||
Some(SelfParam { func: self.id })
|
Some(SelfParam { func: self.id })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn params(self, db: &dyn HirDatabase) -> Vec<Type> {
|
pub fn params(self, db: &dyn HirDatabase) -> Vec<Param> {
|
||||||
let resolver = self.id.resolver(db.upcast());
|
let resolver = self.id.resolver(db.upcast());
|
||||||
let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
|
let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
|
||||||
let environment = TraitEnvironment::lower(db, &resolver);
|
let environment = TraitEnvironment::lower(db, &resolver);
|
||||||
@ -724,7 +724,7 @@ impl Function {
|
|||||||
environment: environment.clone(),
|
environment: environment.clone(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
ty
|
Param { ty }
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
@ -754,6 +754,16 @@ impl From<Mutability> for Access {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct Param {
|
||||||
|
ty: Type,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Param {
|
||||||
|
pub fn ty(&self) -> &Type {
|
||||||
|
&self.ty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct SelfParam {
|
pub struct SelfParam {
|
||||||
func: FunctionId,
|
func: FunctionId,
|
||||||
|
@ -231,7 +231,7 @@ impl Completions {
|
|||||||
if let Some(pat) = it.pat() {
|
if let Some(pat) = it.pat() {
|
||||||
let name = pat.to_string();
|
let name = pat.to_string();
|
||||||
let arg = name.trim_start_matches('_');
|
let arg = name.trim_start_matches('_');
|
||||||
return Some(add_arg(arg, ¶m_ty, ctx));
|
return Some(add_arg(arg, param_ty.ty(), ctx));
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user