add parent & resolve_path

This commit is contained in:
Aleksey Kladov 2019-01-06 14:05:03 +03:00
parent 1836f4db35
commit 3c2cb89087
4 changed files with 67 additions and 5 deletions

View file

@ -1,7 +1,7 @@
use ra_db::{CrateId, Cancelable, FileId};
use ra_syntax::ast;
use crate::{Name, db::HirDatabase, DefId};
use crate::{Name, db::HirDatabase, DefId, Path, PerNs};
/// hir::Crate describes a single crate. It's the main inteface with which
/// crate's dependencies interact. Mostly, it should be just a proxy for the
@ -52,4 +52,12 @@ impl Module {
pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> {
self.child_impl(db, name)
}
/// Finds a parent module.
pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> {
self.parent_impl(db)
}
pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> {
self.resolve_path_impl(db, path)
}
}