mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
internal: Don't eagerly construct AstIdMap
s
This commit is contained in:
parent
84544134f6
commit
e507807837
4 changed files with 32 additions and 24 deletions
|
@ -550,14 +550,17 @@ impl<'a> AssocItemCollector<'a> {
|
|||
AssocItem::MacroCall(call) => {
|
||||
let call = &item_tree[call];
|
||||
let ast_id_map = self.db.ast_id_map(self.expander.current_file_id());
|
||||
let root = self.db.parse_or_expand(self.expander.current_file_id()).unwrap();
|
||||
let call = ast_id_map.get(call.ast_id).to_node(&root);
|
||||
let _cx =
|
||||
stdx::panic_context::enter(format!("collect_items MacroCall: {}", call));
|
||||
let res = self.expander.enter_expand(self.db, call);
|
||||
if let Some(root) = self.db.parse_or_expand(self.expander.current_file_id()) {
|
||||
let call = ast_id_map.get(call.ast_id).to_node(&root);
|
||||
let _cx = stdx::panic_context::enter(format!(
|
||||
"collect_items MacroCall: {}",
|
||||
call
|
||||
));
|
||||
let res = self.expander.enter_expand(self.db, call);
|
||||
|
||||
if let Ok(ExpandResult { value: Some((mark, mac)), .. }) = res {
|
||||
self.collect_macro_items(mark, mac);
|
||||
if let Ok(ExpandResult { value: Some((mark, mac)), .. }) = res {
|
||||
self.collect_macro_items(mark, mac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue