diff options
author | Aleksey Kladov <[email protected]> | 2019-01-01 20:21:16 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-01 21:09:54 +0000 |
commit | 37ed2f35badfb41cd6c50ef04d6fd6a6ce67e0d1 (patch) | |
tree | 8c20a12837045e81f2cec18535a6883f6619939e /crates/ra_hir/src/source_binder.rs | |
parent | 9c65e618498596a5dc75efe0814a5542c54d54d8 (diff) |
rename MFileId -> HirFileId
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 4a99dff84..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. |
22 | pub fn module_from_file_id(db: &impl HirDatabase, file_id: FileId) -> Cancelable<Option<Module>> { | 22 | pub 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() |
@@ -102,11 +102,11 @@ pub fn function_from_module( | |||
102 | module: &Module, | 102 | module: &Module, |
103 | fn_def: ast::FnDef, | 103 | fn_def: ast::FnDef, |
104 | ) -> Function { | 104 | ) -> Function { |
105 | let mfile_id = module.source().file_id().into(); | 105 | let file_id = module.source().file_id(); |
106 | let file_items = db.file_items(mfile_id); | 106 | let file_items = db.file_items(file_id); |
107 | let item_id = file_items.id_of(mfile_id, fn_def.syntax()); | 107 | let item_id = file_items.id_of(file_id, fn_def.syntax()); |
108 | let source_item_id = SourceItemId { | 108 | let source_item_id = SourceItemId { |
109 | mfile_id, | 109 | file_id, |
110 | item_id: Some(item_id), | 110 | item_id: Some(item_id), |
111 | }; | 111 | }; |
112 | let def_loc = DefLoc { | 112 | let def_loc = DefLoc { |