aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/from_source.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/from_source.rs')
-rw-r--r--crates/ra_hir/src/from_source.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index 4acc038e4..307f3d5bf 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -95,7 +95,7 @@ impl FromSource for MacroDef {
95 95
96 let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax())); 96 let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax()));
97 let module = Module::from_definition(db, InFile::new(src.file_id, module_src))?; 97 let module = Module::from_definition(db, InFile::new(src.file_id, module_src))?;
98 let krate = Some(module.krate().crate_id()); 98 let krate = Some(module.krate().id);
99 99
100 let ast_id = Some(AstId::new(src.file_id, db.ast_id_map(src.file_id).ast_id(&src.value))); 100 let ast_id = Some(AstId::new(src.file_id, db.ast_id_map(src.file_id).ast_id(&src.value)));
101 101
@@ -216,8 +216,10 @@ impl Module {
216 } 216 }
217 }?; 217 }?;
218 218
219 let child_name = src.value.name()?; 219 let child_name = src.value.name()?.as_name();
220 parent_module.child(db, &child_name.as_name()) 220 let def_map = db.crate_def_map(parent_module.id.krate);
221 let child_id = def_map[parent_module.id.local_id].children.get(&child_name)?;
222 Some(parent_module.with_module_id(*child_id))
221 } 223 }
222 224
223 pub fn from_definition(db: &impl DefDatabase, src: InFile<ModuleSource>) -> Option<Self> { 225 pub fn from_definition(db: &impl DefDatabase, src: InFile<ModuleSource>) -> Option<Self> {