mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Implement basic inherent method resolution
This commit is contained in:
parent
e9e397e705
commit
082ef52bcb
11 changed files with 309 additions and 17 deletions
|
@ -113,6 +113,11 @@ impl Module {
|
|||
self.child_impl(db, name)
|
||||
}
|
||||
|
||||
/// Iterates over all child modules.
|
||||
pub fn children(&self, db: &impl HirDatabase) -> Cancelable<impl Iterator<Item = Module>> {
|
||||
self.children_impl(db)
|
||||
}
|
||||
|
||||
/// Finds a parent module.
|
||||
pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> {
|
||||
self.parent_impl(db)
|
||||
|
@ -270,6 +275,9 @@ pub struct FnSignature {
|
|||
pub(crate) name: Name,
|
||||
pub(crate) args: Vec<TypeRef>,
|
||||
pub(crate) ret_type: TypeRef,
|
||||
/// True if the first arg is `self`. This is relevant to decide whether this
|
||||
/// can be called as a method.
|
||||
pub(crate) has_self_arg: bool,
|
||||
}
|
||||
|
||||
impl FnSignature {
|
||||
|
@ -284,6 +292,12 @@ impl FnSignature {
|
|||
pub fn ret_type(&self) -> &TypeRef {
|
||||
&self.ret_type
|
||||
}
|
||||
|
||||
/// True if the first arg is `self`. This is relevant to decide whether this
|
||||
/// can be called as a method.
|
||||
pub fn has_self_arg(&self) -> bool {
|
||||
self.has_self_arg
|
||||
}
|
||||
}
|
||||
|
||||
impl Function {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue