diff options
Diffstat (limited to 'crates/hir_def/src/item_tree.rs')
-rw-r--r-- | crates/hir_def/src/item_tree.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index 1e5c94660..42d9f0947 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs | |||
@@ -98,15 +98,17 @@ impl ItemTree { | |||
98 | ctx.lower_module_items(&items) | 98 | ctx.lower_module_items(&items) |
99 | }, | 99 | }, |
100 | ast::MacroStmts(stmts) => { | 100 | ast::MacroStmts(stmts) => { |
101 | ctx.lower_inner_items(stmts.syntax()) | 101 | // The produced statements can include items, which should be added as top-level |
102 | // items. | ||
103 | ctx.lower_macro_stmts(stmts) | ||
102 | }, | 104 | }, |
103 | // Macros can expand to expressions. We return an empty item tree in this case, but | ||
104 | // still need to collect inner items. | ||
105 | ast::Expr(e) => { | 105 | ast::Expr(e) => { |
106 | // Macros can expand to expressions. We return an empty item tree in this case, but | ||
107 | // still need to collect inner items. | ||
106 | ctx.lower_inner_items(e.syntax()) | 108 | ctx.lower_inner_items(e.syntax()) |
107 | }, | 109 | }, |
108 | _ => { | 110 | _ => { |
109 | panic!("cannot create item tree from {:?}", syntax); | 111 | panic!("cannot create item tree from {:?} {}", syntax, syntax); |
110 | }, | 112 | }, |
111 | } | 113 | } |
112 | }; | 114 | }; |