aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree
diff options
context:
space:
mode:
authorcynecx <[email protected]>2021-04-10 16:49:12 +0100
committercynecx <[email protected]>2021-04-17 15:24:56 +0100
commitcf3b4f1e208247c9d171273dabff9c6b3c98a240 (patch)
tree0cae2703b98ba8640ce6693abe32fb51fe27fdda /crates/hir_def/src/item_tree
parentfb2d284f28f70426e39e1b92d95bdbb217a48109 (diff)
hir_ty: Expand macros at type position
Diffstat (limited to 'crates/hir_def/src/item_tree')
-rw-r--r--crates/hir_def/src/item_tree/lower.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index 45b099cf3..2975786dd 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -189,12 +189,16 @@ impl Ctx {
189 block_stack.push(self.source_ast_id_map.ast_id(&block)); 189 block_stack.push(self.source_ast_id_map.ast_id(&block));
190 }, 190 },
191 ast::Item(item) => { 191 ast::Item(item) => {
192 // FIXME: This triggers for macro calls in expression/pattern/type position 192 // FIXME: This triggers for macro calls in expression/pattern
193 let mod_items = self.lower_mod_item(&item, true); 193 if let Some(SyntaxKind::MACRO_TYPE) = node.parent().map(|p| p.kind()) {
194 let current_block = block_stack.last(); 194 // Ignore macros at type position
195 if let (Some(mod_items), Some(block)) = (mod_items, current_block) { 195 } else {
196 if !mod_items.0.is_empty() { 196 let mod_items = self.lower_mod_item(&item, true);
197 self.data().inner_items.entry(*block).or_default().extend(mod_items.0.iter().copied()); 197 let current_block = block_stack.last();
198 if let (Some(mod_items), Some(block)) = (mod_items, current_block) {
199 if !mod_items.0.is_empty() {
200 self.data().inner_items.entry(*block).or_default().extend(mod_items.0.iter().copied());
201 }
198 } 202 }
199 } 203 }
200 }, 204 },