aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/query_definitions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r--crates/ra_hir/src/query_definitions.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs
index f4b380022..8f2c40669 100644
--- a/crates/ra_hir/src/query_definitions.rs
+++ b/crates/ra_hir/src/query_definitions.rs
@@ -11,11 +11,11 @@ use ra_syntax::{
11use ra_db::{SourceRootId, Cancelable,}; 11use ra_db::{SourceRootId, Cancelable,};
12 12
13use crate::{ 13use crate::{
14 SourceFileItems, SourceItemId, DefKind, DefId, HirFileId, 14 SourceFileItems, SourceItemId, DefKind, DefId, HirFileId, ModuleSource,
15 MacroCallLoc, 15 MacroCallLoc,
16 db::HirDatabase, 16 db::HirDatabase,
17 function::FnScopes, 17 function::FnScopes,
18 module_tree::{ModuleId, ModuleSourceNode}, 18 module_tree::ModuleId,
19 nameres::{InputModuleItems, ItemMap, Resolver}, 19 nameres::{InputModuleItems, ItemMap, Resolver},
20 adt::{StructData, EnumData}, 20 adt::{StructData, EnumData},
21}; 21};
@@ -65,7 +65,8 @@ pub(super) fn input_module_items(
65) -> Cancelable<Arc<InputModuleItems>> { 65) -> Cancelable<Arc<InputModuleItems>> {
66 let module_tree = db.module_tree(source_root_id)?; 66 let module_tree = db.module_tree(source_root_id)?;
67 let source = module_id.source(&module_tree); 67 let source = module_id.source(&module_tree);
68 let file_id = source.file_id(); 68 let file_id = source.file_id;
69 let source = ModuleSource::from_source_item_id(db, source);
69 let file_items = db.file_items(file_id); 70 let file_items = db.file_items(file_id);
70 let fill = |acc: &mut InputModuleItems, items: &mut Iterator<Item = ast::ItemOrMacro>| { 71 let fill = |acc: &mut InputModuleItems, items: &mut Iterator<Item = ast::ItemOrMacro>| {
71 for item in items { 72 for item in items {
@@ -96,9 +97,9 @@ pub(super) fn input_module_items(
96 }; 97 };
97 98
98 let mut res = InputModuleItems::default(); 99 let mut res = InputModuleItems::default();
99 match source.resolve(db) { 100 match source {
100 ModuleSourceNode::SourceFile(it) => fill(&mut res, &mut it.borrowed().items_with_macros()), 101 ModuleSource::SourceFile(it) => fill(&mut res, &mut it.borrowed().items_with_macros()),
101 ModuleSourceNode::Module(it) => { 102 ModuleSource::Module(it) => {
102 if let Some(item_list) = it.borrowed().item_list() { 103 if let Some(item_list) = it.borrowed().item_list() {
103 fill(&mut res, &mut item_list.items_with_macros()) 104 fill(&mut res, &mut item_list.items_with_macros())
104 } 105 }