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/item_scope.rs | |
parent | af42cb5981a1f94116b1da8cfeedb6efdd5aeb01 (diff) |
Make legacy macros private
Diffstat (limited to 'crates/ra_hir_def/src/item_scope.rs')
-rw-r--r-- | crates/ra_hir_def/src/item_scope.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/item_scope.rs b/crates/ra_hir_def/src/item_scope.rs index f51e97ef9..6b9be8325 100644 --- a/crates/ra_hir_def/src/item_scope.rs +++ b/crates/ra_hir_def/src/item_scope.rs | |||
@@ -23,7 +23,7 @@ pub struct ItemScope { | |||
23 | /// Module scoped macros will be inserted into `items` instead of here. | 23 | /// Module scoped macros will be inserted into `items` instead of here. |
24 | // FIXME: Macro shadowing in one module is not properly handled. Non-item place macros will | 24 | // FIXME: Macro shadowing in one module is not properly handled. Non-item place macros will |
25 | // be all resolved to the last one defined if shadowing happens. | 25 | // be all resolved to the last one defined if shadowing happens. |
26 | pub(crate) legacy_macros: FxHashMap<Name, MacroDefId>, | 26 | legacy_macros: FxHashMap<Name, MacroDefId>, |
27 | } | 27 | } |
28 | 28 | ||
29 | static BUILTIN_SCOPE: Lazy<FxHashMap<Name, Resolution>> = Lazy::new(|| { | 29 | static BUILTIN_SCOPE: Lazy<FxHashMap<Name, Resolution>> = Lazy::new(|| { |
@@ -108,6 +108,10 @@ impl ItemScope { | |||
108 | self.impls.push(imp) | 108 | self.impls.push(imp) |
109 | } | 109 | } |
110 | 110 | ||
111 | pub(crate) fn define_legacy_macro(&mut self, name: Name, mac: MacroDefId) { | ||
112 | self.legacy_macros.insert(name, mac); | ||
113 | } | ||
114 | |||
111 | pub(crate) fn push_res( | 115 | pub(crate) fn push_res( |
112 | &mut self, | 116 | &mut self, |
113 | name: Name, | 117 | name: Name, |
@@ -146,6 +150,10 @@ impl ItemScope { | |||
146 | pub(crate) fn collect_resolutions(&self) -> Vec<(Name, Resolution)> { | 150 | pub(crate) fn collect_resolutions(&self) -> Vec<(Name, Resolution)> { |
147 | self.items.iter().map(|(name, res)| (name.clone(), res.clone())).collect() | 151 | self.items.iter().map(|(name, res)| (name.clone(), res.clone())).collect() |
148 | } | 152 | } |
153 | |||
154 | pub(crate) fn collect_legacy_macros(&self) -> FxHashMap<Name, MacroDefId> { | ||
155 | self.legacy_macros.clone() | ||
156 | } | ||
149 | } | 157 | } |
150 | 158 | ||
151 | #[derive(Debug, Clone, PartialEq, Eq, Default)] | 159 | #[derive(Debug, Clone, PartialEq, Eq, Default)] |