aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2021-03-31 20:45:21 +0100
committerEdwin Cheng <[email protected]>2021-03-31 20:45:21 +0100
commit6a3f2ce76ca06c5541b3bdd8c626abedbc812685 (patch)
treeaa6332ca2acceaaf43787817d7bb174f4595556b /crates/hir_def/src
parent75011bbccbf2e00092222a1071ba9111f834a4ae (diff)
Fix block inner item defined in macro
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/item_tree/lower.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index 8d3862811..124dcc866 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -174,6 +174,12 @@ impl Ctx {
174 let forced_vis = self.forced_visibility.take(); 174 let forced_vis = self.forced_visibility.take();
175 175
176 let mut block_stack = Vec::new(); 176 let mut block_stack = Vec::new();
177
178 // if container itself is block, add it to the stack
179 if let Some(block) = ast::BlockExpr::cast(container.clone()) {
180 block_stack.push(self.source_ast_id_map.ast_id(&block));
181 }
182
177 for event in container.preorder().skip(1) { 183 for event in container.preorder().skip(1) {
178 match event { 184 match event {
179 WalkEvent::Enter(node) => { 185 WalkEvent::Enter(node) => {