aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index a0d1daf71..24490d119 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -20,7 +20,7 @@ use crate::{
20 20
21/// Locates the module by `FileId`. Picks topmost module in the file. 21/// Locates the module by `FileId`. Picks topmost module in the file.
22pub fn module_from_file_id(db: &impl HirDatabase, file_id: FileId) -> Cancelable<Option<Module>> { 22pub fn module_from_file_id(db: &impl HirDatabase, file_id: FileId) -> Cancelable<Option<Module>> {
23 let module_source = ModuleSource::new_file(file_id); 23 let module_source = ModuleSource::new_file(file_id.into());
24 module_from_source(db, module_source) 24 module_from_source(db, module_source)
25} 25}
26 26
@@ -50,8 +50,8 @@ pub fn module_from_position(
50) -> Cancelable<Option<Module>> { 50) -> Cancelable<Option<Module>> {
51 let file = db.source_file(position.file_id); 51 let file = db.source_file(position.file_id);
52 let module_source = match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) { 52 let module_source = match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) {
53 Some(m) if !m.has_semi() => ModuleSource::new_inline(db, position.file_id, m), 53 Some(m) if !m.has_semi() => ModuleSource::new_inline(db, position.file_id.into(), m),
54 _ => ModuleSource::new_file(position.file_id), 54 _ => ModuleSource::new_file(position.file_id.into()),
55 }; 55 };
56 module_from_source(db, module_source) 56 module_from_source(db, module_source)
57} 57}
@@ -67,9 +67,9 @@ pub fn module_from_child_node(
67 .filter_map(ast::Module::cast) 67 .filter_map(ast::Module::cast)
68 .find(|it| !it.has_semi()) 68 .find(|it| !it.has_semi())
69 { 69 {
70 ModuleSource::new_inline(db, file_id, m) 70 ModuleSource::new_inline(db, file_id.into(), m)
71 } else { 71 } else {
72 ModuleSource::new_file(file_id) 72 ModuleSource::new_file(file_id.into())
73 }; 73 };
74 module_from_source(db, module_source) 74 module_from_source(db, module_source)
75} 75}
@@ -78,7 +78,7 @@ fn module_from_source(
78 db: &impl HirDatabase, 78 db: &impl HirDatabase,
79 module_source: ModuleSource, 79 module_source: ModuleSource,
80) -> Cancelable<Option<Module>> { 80) -> Cancelable<Option<Module>> {
81 let source_root_id = db.file_source_root(module_source.file_id()); 81 let source_root_id = db.file_source_root(module_source.file_id().as_original_file());
82 let module_tree = db.module_tree(source_root_id)?; 82 let module_tree = db.module_tree(source_root_id)?;
83 let m = module_tree 83 let m = module_tree
84 .modules_with_sources() 84 .modules_with_sources()