diff options
author | Aleksey Kladov <[email protected]> | 2019-01-06 16:58:10 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-06 17:01:26 +0000 |
commit | 8a3b489c2f57bdf8f6241e69276efa48b5ed4a98 (patch) | |
tree | 2032c28d8a72b162abe9f7b8dddffef7f036b91d /crates/ra_hir/src/query_definitions.rs | |
parent | cf0ce14351af03c620aca784ee2c03aad86b866e (diff) |
kill module source
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r-- | crates/ra_hir/src/query_definitions.rs | 13 |
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::{ | |||
11 | use ra_db::{SourceRootId, Cancelable,}; | 11 | use ra_db::{SourceRootId, Cancelable,}; |
12 | 12 | ||
13 | use crate::{ | 13 | use 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 | } |