Option begone part 2

This commit is contained in:
Lukas Wirth 2023-04-16 19:20:48 +02:00
parent 96a774261f
commit a2a3fecae3
31 changed files with 113 additions and 152 deletions

View file

@ -640,22 +640,20 @@ impl<'a> AssocItemCollector<'a> {
AssocItem::MacroCall(call) => {
let file_id = self.expander.current_file_id();
let root = self.db.parse_or_expand(file_id);
if let Some(root) = root {
let call = &item_tree[call];
let call = &item_tree[call];
let ast_id_map = self.db.ast_id_map(file_id);
let macro_call = ast_id_map.get(call.ast_id).to_node(&root);
let _cx = stdx::panic_context::enter(format!(
"collect_items MacroCall: {macro_call}"
));
if let Ok(res) =
self.expander.enter_expand::<ast::MacroItems>(self.db, macro_call)
{
self.collect_macro_items(res, &|| hir_expand::MacroCallKind::FnLike {
ast_id: InFile::new(file_id, call.ast_id),
expand_to: hir_expand::ExpandTo::Items,
});
}
let ast_id_map = self.db.ast_id_map(file_id);
let macro_call = ast_id_map.get(call.ast_id).to_node(&root);
let _cx = stdx::panic_context::enter(format!(
"collect_items MacroCall: {macro_call}"
));
if let Ok(res) =
self.expander.enter_expand::<ast::MacroItems>(self.db, macro_call)
{
self.collect_macro_items(res, &|| hir_expand::MacroCallKind::FnLike {
ast_id: InFile::new(file_id, call.ast_id),
expand_to: hir_expand::ExpandTo::Items,
});
}
}
}