diff options
author | Aleksey Kladov <[email protected]> | 2019-12-20 16:09:13 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-20 16:12:20 +0000 |
commit | 7a862f0d47e8ae018d449a04c918ea3705785552 (patch) | |
tree | 48200c7e43dbd10f9a584c360019b4721ac46285 /crates/ra_hir_def/src/nameres/collector.rs | |
parent | af42cb5981a1f94116b1da8cfeedb6efdd5aeb01 (diff) |
Make legacy macros private
Diffstat (limited to 'crates/ra_hir_def/src/nameres/collector.rs')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index b064ccc9c..8b641d8b5 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -231,9 +231,9 @@ where | |||
231 | /// the definition of current module. | 231 | /// the definition of current module. |
232 | /// And also, `macro_use` on a module will import all legacy macros visible inside to | 232 | /// And also, `macro_use` on a module will import all legacy macros visible inside to |
233 | /// current legacy scope, with possible shadowing. | 233 | /// current legacy scope, with possible shadowing. |
234 | fn define_legacy_macro(&mut self, module_id: LocalModuleId, name: Name, macro_: MacroDefId) { | 234 | fn define_legacy_macro(&mut self, module_id: LocalModuleId, name: Name, mac: MacroDefId) { |
235 | // Always shadowing | 235 | // Always shadowing |
236 | self.def_map.modules[module_id].scope.legacy_macros.insert(name, macro_); | 236 | self.def_map.modules[module_id].scope.define_legacy_macro(name, mac); |
237 | } | 237 | } |
238 | 238 | ||
239 | /// Import macros from `#[macro_use] extern crate`. | 239 | /// Import macros from `#[macro_use] extern crate`. |
@@ -711,7 +711,9 @@ where | |||
711 | let res = modules.alloc(ModuleData::default()); | 711 | let res = modules.alloc(ModuleData::default()); |
712 | modules[res].parent = Some(self.module_id); | 712 | modules[res].parent = Some(self.module_id); |
713 | modules[res].origin = ModuleOrigin::not_sure_file(definition, declaration); | 713 | modules[res].origin = ModuleOrigin::not_sure_file(definition, declaration); |
714 | modules[res].scope.legacy_macros = modules[self.module_id].scope.legacy_macros.clone(); | 714 | for (name, mac) in modules[self.module_id].scope.collect_legacy_macros() { |
715 | modules[res].scope.define_legacy_macro(name, mac) | ||
716 | } | ||
715 | modules[self.module_id].children.insert(name.clone(), res); | 717 | modules[self.module_id].children.insert(name.clone(), res); |
716 | let resolution = Resolution { | 718 | let resolution = Resolution { |
717 | def: PerNs::types( | 719 | def: PerNs::types( |
@@ -875,7 +877,7 @@ where | |||
875 | } | 877 | } |
876 | 878 | ||
877 | fn import_all_legacy_macros(&mut self, module_id: LocalModuleId) { | 879 | fn import_all_legacy_macros(&mut self, module_id: LocalModuleId) { |
878 | let macros = self.def_collector.def_map[module_id].scope.legacy_macros.clone(); | 880 | let macros = self.def_collector.def_map[module_id].scope.collect_legacy_macros(); |
879 | for (name, macro_) in macros { | 881 | for (name, macro_) in macros { |
880 | self.def_collector.define_legacy_macro(self.module_id, name.clone(), macro_); | 882 | self.def_collector.define_legacy_macro(self.module_id, name.clone(), macro_); |
881 | } | 883 | } |