diff options
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 22 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/tests.rs | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index e7afc34c9..f2336c271 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs | |||
@@ -12,7 +12,7 @@ use crate::{ | |||
12 | ids::{AstItemDef, LocationCtx, MacroCallLoc, SourceItemId, MacroCallId}, | 12 | ids::{AstItemDef, LocationCtx, MacroCallLoc, SourceItemId, MacroCallId}, |
13 | }; | 13 | }; |
14 | 14 | ||
15 | use super::{CrateDefMap, ModuleId, ModuleData}; | 15 | use super::{CrateDefMap, CrateModuleId, ModuleData}; |
16 | 16 | ||
17 | pub(super) fn collect_defs( | 17 | pub(super) fn collect_defs( |
18 | db: &impl PersistentHirDatabase, | 18 | db: &impl PersistentHirDatabase, |
@@ -49,9 +49,9 @@ pub(super) fn collect_defs( | |||
49 | struct DefCollector<DB> { | 49 | struct DefCollector<DB> { |
50 | db: DB, | 50 | db: DB, |
51 | def_map: CrateDefMap, | 51 | def_map: CrateDefMap, |
52 | glob_imports: FxHashMap<ModuleId, Vec<(ModuleId, raw::ImportId)>>, | 52 | glob_imports: FxHashMap<CrateModuleId, Vec<(CrateModuleId, raw::ImportId)>>, |
53 | unresolved_imports: Vec<(ModuleId, raw::ImportId, raw::ImportData)>, | 53 | unresolved_imports: Vec<(CrateModuleId, raw::ImportId, raw::ImportData)>, |
54 | unexpanded_macros: Vec<(ModuleId, MacroCallId, Path, tt::Subtree)>, | 54 | unexpanded_macros: Vec<(CrateModuleId, MacroCallId, Path, tt::Subtree)>, |
55 | global_macro_scope: FxHashMap<Name, mbe::MacroRules>, | 55 | global_macro_scope: FxHashMap<Name, mbe::MacroRules>, |
56 | } | 56 | } |
57 | 57 | ||
@@ -124,7 +124,7 @@ where | |||
124 | 124 | ||
125 | fn resolve_import( | 125 | fn resolve_import( |
126 | &mut self, | 126 | &mut self, |
127 | module_id: ModuleId, | 127 | module_id: CrateModuleId, |
128 | import: &raw::ImportData, | 128 | import: &raw::ImportData, |
129 | ) -> (PerNs<ModuleDef>, ReachedFixedPoint) { | 129 | ) -> (PerNs<ModuleDef>, ReachedFixedPoint) { |
130 | log::debug!("resolving import: {:?} ({:?})", import, self.def_map.edition); | 130 | log::debug!("resolving import: {:?} ({:?})", import, self.def_map.edition); |
@@ -147,7 +147,7 @@ where | |||
147 | 147 | ||
148 | fn record_resolved_import( | 148 | fn record_resolved_import( |
149 | &mut self, | 149 | &mut self, |
150 | module_id: ModuleId, | 150 | module_id: CrateModuleId, |
151 | def: PerNs<ModuleDef>, | 151 | def: PerNs<ModuleDef>, |
152 | import_id: raw::ImportId, | 152 | import_id: raw::ImportId, |
153 | import: &raw::ImportData, | 153 | import: &raw::ImportData, |
@@ -234,7 +234,7 @@ where | |||
234 | 234 | ||
235 | fn update( | 235 | fn update( |
236 | &mut self, | 236 | &mut self, |
237 | module_id: ModuleId, | 237 | module_id: CrateModuleId, |
238 | import: Option<raw::ImportId>, | 238 | import: Option<raw::ImportId>, |
239 | resolutions: &[(Name, Resolution)], | 239 | resolutions: &[(Name, Resolution)], |
240 | ) { | 240 | ) { |
@@ -243,7 +243,7 @@ where | |||
243 | 243 | ||
244 | fn update_recursive( | 244 | fn update_recursive( |
245 | &mut self, | 245 | &mut self, |
246 | module_id: ModuleId, | 246 | module_id: CrateModuleId, |
247 | import: Option<raw::ImportId>, | 247 | import: Option<raw::ImportId>, |
248 | resolutions: &[(Name, Resolution)], | 248 | resolutions: &[(Name, Resolution)], |
249 | depth: usize, | 249 | depth: usize, |
@@ -327,7 +327,7 @@ where | |||
327 | 327 | ||
328 | fn collect_macro_expansion( | 328 | fn collect_macro_expansion( |
329 | &mut self, | 329 | &mut self, |
330 | module_id: ModuleId, | 330 | module_id: CrateModuleId, |
331 | macro_call_id: MacroCallId, | 331 | macro_call_id: MacroCallId, |
332 | expansion: tt::Subtree, | 332 | expansion: tt::Subtree, |
333 | ) { | 333 | ) { |
@@ -353,7 +353,7 @@ where | |||
353 | /// Walks a single module, populating defs, imports and macros | 353 | /// Walks a single module, populating defs, imports and macros |
354 | struct ModCollector<'a, D> { | 354 | struct ModCollector<'a, D> { |
355 | def_collector: D, | 355 | def_collector: D, |
356 | module_id: ModuleId, | 356 | module_id: CrateModuleId, |
357 | file_id: HirFileId, | 357 | file_id: HirFileId, |
358 | raw_items: &'a raw::RawItems, | 358 | raw_items: &'a raw::RawItems, |
359 | } | 359 | } |
@@ -426,7 +426,7 @@ where | |||
426 | name: Name, | 426 | name: Name, |
427 | declaration: SourceItemId, | 427 | declaration: SourceItemId, |
428 | definition: Option<FileId>, | 428 | definition: Option<FileId>, |
429 | ) -> ModuleId { | 429 | ) -> CrateModuleId { |
430 | let modules = &mut self.def_collector.def_map.modules; | 430 | let modules = &mut self.def_collector.def_map.modules; |
431 | let res = modules.alloc(ModuleData::default()); | 431 | let res = modules.alloc(ModuleData::default()); |
432 | modules[res].parent = Some(self.module_id); | 432 | modules[res].parent = Some(self.module_id); |
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index f73f9d8a6..ac9b88520 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -27,7 +27,7 @@ fn render_crate_def_map(map: &CrateDefMap) -> String { | |||
27 | go(&mut buf, map, "\ncrate", map.root); | 27 | go(&mut buf, map, "\ncrate", map.root); |
28 | return buf; | 28 | return buf; |
29 | 29 | ||
30 | fn go(buf: &mut String, map: &CrateDefMap, path: &str, module: ModuleId) { | 30 | fn go(buf: &mut String, map: &CrateDefMap, path: &str, module: CrateModuleId) { |
31 | *buf += path; | 31 | *buf += path; |
32 | *buf += "\n"; | 32 | *buf += "\n"; |
33 | for (name, res) in map.modules[module].scope.items.iter() { | 33 | for (name, res) in map.modules[module].scope.items.iter() { |