diff options
Diffstat (limited to 'crates/ra_hir_def/src/nameres/collector.rs')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index f4678d145..63beaedc5 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -24,7 +24,7 @@ use crate::{ | |||
24 | }, | 24 | }, |
25 | path::{ModPath, PathKind}, | 25 | path::{ModPath, PathKind}, |
26 | per_ns::PerNs, | 26 | per_ns::PerNs, |
27 | visibility::ResolvedVisibility, | 27 | visibility::Visibility, |
28 | AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern, | 28 | AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern, |
29 | LocalModuleId, ModuleDefId, ModuleId, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, | 29 | LocalModuleId, ModuleDefId, ModuleId, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, |
30 | }; | 30 | }; |
@@ -109,7 +109,7 @@ struct MacroDirective { | |||
109 | struct DefCollector<'a, DB> { | 109 | struct DefCollector<'a, DB> { |
110 | db: &'a DB, | 110 | db: &'a DB, |
111 | def_map: CrateDefMap, | 111 | def_map: CrateDefMap, |
112 | glob_imports: FxHashMap<LocalModuleId, Vec<(LocalModuleId, ResolvedVisibility)>>, | 112 | glob_imports: FxHashMap<LocalModuleId, Vec<(LocalModuleId, Visibility)>>, |
113 | unresolved_imports: Vec<ImportDirective>, | 113 | unresolved_imports: Vec<ImportDirective>, |
114 | resolved_imports: Vec<ImportDirective>, | 114 | resolved_imports: Vec<ImportDirective>, |
115 | unexpanded_macros: Vec<MacroDirective>, | 115 | unexpanded_macros: Vec<MacroDirective>, |
@@ -217,8 +217,8 @@ where | |||
217 | if export { | 217 | if export { |
218 | self.update( | 218 | self.update( |
219 | self.def_map.root, | 219 | self.def_map.root, |
220 | &[(name, PerNs::macros(macro_, ResolvedVisibility::Public))], | 220 | &[(name, PerNs::macros(macro_, Visibility::Public))], |
221 | ResolvedVisibility::Public, | 221 | Visibility::Public, |
222 | ); | 222 | ); |
223 | } | 223 | } |
224 | } | 224 | } |
@@ -358,7 +358,7 @@ where | |||
358 | let vis = self | 358 | let vis = self |
359 | .def_map | 359 | .def_map |
360 | .resolve_visibility(self.db, module_id, &directive.import.visibility) | 360 | .resolve_visibility(self.db, module_id, &directive.import.visibility) |
361 | .unwrap_or(ResolvedVisibility::Public); | 361 | .unwrap_or(Visibility::Public); |
362 | 362 | ||
363 | if import.is_glob { | 363 | if import.is_glob { |
364 | log::debug!("glob import: {:?}", import); | 364 | log::debug!("glob import: {:?}", import); |
@@ -461,12 +461,7 @@ where | |||
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 | ||
464 | fn update( | 464 | fn update(&mut self, module_id: LocalModuleId, resolutions: &[(Name, PerNs)], vis: Visibility) { |
465 | &mut self, | ||
466 | module_id: LocalModuleId, | ||
467 | resolutions: &[(Name, PerNs)], | ||
468 | vis: ResolvedVisibility, | ||
469 | ) { | ||
470 | self.update_recursive(module_id, resolutions, vis, 0) | 465 | self.update_recursive(module_id, resolutions, vis, 0) |
471 | } | 466 | } |
472 | 467 | ||
@@ -476,7 +471,7 @@ where | |||
476 | resolutions: &[(Name, PerNs)], | 471 | resolutions: &[(Name, PerNs)], |
477 | // All resolutions are imported with this visibility; the visibilies in | 472 | // All resolutions are imported with this visibility; the visibilies in |
478 | // the `PerNs` values are ignored and overwritten | 473 | // the `PerNs` values are ignored and overwritten |
479 | vis: ResolvedVisibility, | 474 | vis: Visibility, |
480 | depth: usize, | 475 | depth: usize, |
481 | ) { | 476 | ) { |
482 | if depth > 100 { | 477 | if depth > 100 { |
@@ -749,7 +744,7 @@ where | |||
749 | .def_collector | 744 | .def_collector |
750 | .def_map | 745 | .def_map |
751 | .resolve_visibility(self.def_collector.db, self.module_id, visibility) | 746 | .resolve_visibility(self.def_collector.db, self.module_id, visibility) |
752 | .unwrap_or(ResolvedVisibility::Public); | 747 | .unwrap_or(Visibility::Public); |
753 | let modules = &mut self.def_collector.def_map.modules; | 748 | let modules = &mut self.def_collector.def_map.modules; |
754 | let res = modules.alloc(ModuleData::default()); | 749 | let res = modules.alloc(ModuleData::default()); |
755 | modules[res].parent = Some(self.module_id); | 750 | modules[res].parent = Some(self.module_id); |
@@ -825,7 +820,7 @@ where | |||
825 | .def_collector | 820 | .def_collector |
826 | .def_map | 821 | .def_map |
827 | .resolve_visibility(self.def_collector.db, self.module_id, vis) | 822 | .resolve_visibility(self.def_collector.db, self.module_id, vis) |
828 | .unwrap_or(ResolvedVisibility::Public); | 823 | .unwrap_or(Visibility::Public); |
829 | self.def_collector.update(self.module_id, &[(name, PerNs::from_def(def, vis))], vis) | 824 | self.def_collector.update(self.module_id, &[(name, PerNs::from_def(def, vis))], vis) |
830 | } | 825 | } |
831 | 826 | ||