Implement basic inherent method resolution

This commit is contained in:
Florian Diebold 2019-01-07 13:44:54 +01:00
parent e9e397e705
commit 082ef52bcb
11 changed files with 309 additions and 17 deletions

View file

@ -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 {