Refactor Module::from_source to properly descend from root file

This commit is contained in:
Aleksey Kladov 2019-11-15 10:26:31 +03:00
parent bbb022d399
commit 9c7a2aef30
3 changed files with 44 additions and 33 deletions

View file

@ -157,7 +157,7 @@ impl Module {
}
/// Finds a child module with the specified name.
pub fn child(self, db: &impl HirDatabase, name: &Name) -> Option<Module> {
pub fn child(self, db: &impl DefDatabase, name: &Name) -> Option<Module> {
let def_map = db.crate_def_map(self.id.krate);
let child_id = def_map[self.id.module_id].children.get(name)?;
Some(self.with_module_id(*child_id))