From ce211434a6501e88cb83462f2443db085f1557d3 Mon Sep 17 00:00:00 2001 From: Lenard Pratt Date: Mon, 15 Apr 2019 11:01:29 +0100 Subject: Added macro resolution and expansion --- crates/ra_hir/src/nameres/collector.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir/src/nameres/collector.rs') diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index 4590a5184..762a61604 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs @@ -131,6 +131,8 @@ where fn define_macro(&mut self, name: Name, macro_id: MacroDefId, export: bool) { if export { self.def_map.public_macros.insert(name.clone(), macro_id); + } else { + self.def_map.local_macros.insert(name.clone(), macro_id); } self.global_macro_scope.insert(name, macro_id); } @@ -517,10 +519,10 @@ where // Case 2: try to expand macro_rules from this crate, triggering // recursive item collection. - if let Some(¯o_id) = - mac.path.as_ident().and_then(|name| self.def_collector.global_macro_scope.get(name)) + if let Some(macro_id) = + mac.path.as_ident().and_then(|name| self.def_collector.global_macro_scope.get(&name)) { - let macro_call_id = MacroCallLoc { def: macro_id, ast_id }.id(self.def_collector.db); + let macro_call_id = MacroCallLoc { def: *macro_id, ast_id }.id(self.def_collector.db); self.def_collector.collect_macro_expansion(self.module_id, macro_call_id, macro_id); return; -- cgit v1.2.3