aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/item_scope.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/item_scope.rs')
-rw-r--r--crates/ra_hir_def/src/item_scope.rs10
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
29static BUILTIN_SCOPE: Lazy<FxHashMap<Name, Resolution>> = Lazy::new(|| { 29static 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)]