diff options
author | Lenard Pratt <[email protected]> | 2019-04-15 11:01:29 +0100 |
---|---|---|
committer | Lenard Pratt <[email protected]> | 2019-04-22 21:35:44 +0100 |
commit | ce211434a6501e88cb83462f2443db085f1557d3 (patch) | |
tree | 2b0b2118fa38046d7b527ea1ea81d1c01a9a8207 /crates/ra_hir/src/nameres/collector.rs | |
parent | afaeb18910414166801e3ca51272cfa3661175a4 (diff) |
Added macro resolution and expansion
Diffstat (limited to 'crates/ra_hir/src/nameres/collector.rs')
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 8 |
1 files changed, 5 insertions, 3 deletions
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 | |||
131 | fn define_macro(&mut self, name: Name, macro_id: MacroDefId, export: bool) { | 131 | fn define_macro(&mut self, name: Name, macro_id: MacroDefId, export: bool) { |
132 | if export { | 132 | if export { |
133 | self.def_map.public_macros.insert(name.clone(), macro_id); | 133 | self.def_map.public_macros.insert(name.clone(), macro_id); |
134 | } else { | ||
135 | self.def_map.local_macros.insert(name.clone(), macro_id); | ||
134 | } | 136 | } |
135 | self.global_macro_scope.insert(name, macro_id); | 137 | self.global_macro_scope.insert(name, macro_id); |
136 | } | 138 | } |
@@ -517,10 +519,10 @@ where | |||
517 | 519 | ||
518 | // Case 2: try to expand macro_rules from this crate, triggering | 520 | // Case 2: try to expand macro_rules from this crate, triggering |
519 | // recursive item collection. | 521 | // recursive item collection. |
520 | if let Some(¯o_id) = | 522 | if let Some(macro_id) = |
521 | mac.path.as_ident().and_then(|name| self.def_collector.global_macro_scope.get(name)) | 523 | mac.path.as_ident().and_then(|name| self.def_collector.global_macro_scope.get(&name)) |
522 | { | 524 | { |
523 | let macro_call_id = MacroCallLoc { def: macro_id, ast_id }.id(self.def_collector.db); | 525 | let macro_call_id = MacroCallLoc { def: *macro_id, ast_id }.id(self.def_collector.db); |
524 | 526 | ||
525 | self.def_collector.collect_macro_expansion(self.module_id, macro_call_id, macro_id); | 527 | self.def_collector.collect_macro_expansion(self.module_id, macro_call_id, macro_id); |
526 | return; | 528 | return; |