aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres.rs')
-rw-r--r--crates/ra_hir/src/nameres.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index fbfff4fd7..a450d7b84 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -104,6 +104,7 @@ pub struct CrateDefMap {
104 /// However, do we want to put it as a global variable? 104 /// However, do we want to put it as a global variable?
105 poison_macros: FxHashSet<MacroDefId>, 105 poison_macros: FxHashSet<MacroDefId>,
106 106
107 local_macros: FxHashMap<Name, MacroDefId>,
107 diagnostics: Vec<DefDiagnostic>, 108 diagnostics: Vec<DefDiagnostic>,
108} 109}
109 110
@@ -209,6 +210,7 @@ impl CrateDefMap {
209 modules, 210 modules,
210 public_macros: FxHashMap::default(), 211 public_macros: FxHashMap::default(),
211 poison_macros: FxHashSet::default(), 212 poison_macros: FxHashSet::default(),
213 local_macros: FxHashMap::default(),
212 diagnostics: Vec::new(), 214 diagnostics: Vec::new(),
213 } 215 }
214 }; 216 };
@@ -270,6 +272,10 @@ impl CrateDefMap {
270 (res.resolved_def, res.segment_index) 272 (res.resolved_def, res.segment_index)
271 } 273 }
272 274
275 pub(crate) fn find_macro(&self, name: &Name) -> Option<&MacroDefId> {
276 self.public_macros.get(name).or(self.local_macros.get(name))
277 }
278
273 // Returns Yes if we are sure that additions to `ItemMap` wouldn't change 279 // Returns Yes if we are sure that additions to `ItemMap` wouldn't change
274 // the result. 280 // the result.
275 fn resolve_path_fp( 281 fn resolve_path_fp(