diff options
author | Marco Groppo <[email protected]> | 2019-03-26 19:26:16 +0000 |
---|---|---|
committer | Marco Groppo <[email protected]> | 2019-03-26 19:26:16 +0000 |
commit | 6030d6f500e42bde012a391666b68363d8479d21 (patch) | |
tree | 42c799a75b1803afe1838818de86cebe9674c38a /crates/ra_hir/src/source_binder.rs | |
parent | 12b5d4f795f69f7fa07051cdec7a1347d3aa7924 (diff) | |
parent | 1011e37f3a260b0565f88c84d3c49fac1ec7b879 (diff) |
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into flip-binexpr
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 3645b73b4..9dae4c3d1 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -15,8 +15,8 @@ use ra_syntax::{ | |||
15 | use crate::{ | 15 | use crate::{ |
16 | HirDatabase, Function, Struct, Enum, | 16 | HirDatabase, Function, Struct, Enum, |
17 | AsName, Module, HirFileId, Crate, Trait, Resolver, | 17 | AsName, Module, HirFileId, Crate, Trait, Resolver, |
18 | ids::{LocationCtx, SourceFileItemId}, | 18 | ids::LocationCtx, |
19 | expr | 19 | expr, AstId |
20 | }; | 20 | }; |
21 | 21 | ||
22 | /// Locates the module by `FileId`. Picks topmost module in the file. | 22 | /// Locates the module by `FileId`. Picks topmost module in the file. |
@@ -54,8 +54,8 @@ fn module_from_inline( | |||
54 | ) -> Option<Module> { | 54 | ) -> Option<Module> { |
55 | assert!(!module.has_semi()); | 55 | assert!(!module.has_semi()); |
56 | let file_id = file_id.into(); | 56 | let file_id = file_id.into(); |
57 | let file_items = db.file_items(file_id); | 57 | let ast_id_map = db.ast_id_map(file_id); |
58 | let item_id = file_items.id_of(file_id, module.syntax()); | 58 | let item_id = ast_id_map.ast_id(module).with_file_id(file_id); |
59 | module_from_source(db, file_id, Some(item_id)) | 59 | module_from_source(db, file_id, Some(item_id)) |
60 | } | 60 | } |
61 | 61 | ||
@@ -75,7 +75,7 @@ pub fn module_from_child_node( | |||
75 | fn module_from_source( | 75 | fn module_from_source( |
76 | db: &impl HirDatabase, | 76 | db: &impl HirDatabase, |
77 | file_id: HirFileId, | 77 | file_id: HirFileId, |
78 | decl_id: Option<SourceFileItemId>, | 78 | decl_id: Option<AstId<ast::Module>>, |
79 | ) -> Option<Module> { | 79 | ) -> Option<Module> { |
80 | let source_root_id = db.file_source_root(file_id.as_original_file()); | 80 | let source_root_id = db.file_source_root(file_id.as_original_file()); |
81 | db.source_root_crates(source_root_id).iter().map(|&crate_id| Crate { crate_id }).find_map( | 81 | db.source_root_crates(source_root_id).iter().map(|&crate_id| Crate { crate_id }).find_map( |