mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Option begone part 2
This commit is contained in:
parent
96a774261f
commit
a2a3fecae3
31 changed files with 113 additions and 152 deletions
|
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue