mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Handle MacCall items directly in the def collector
instead of entangling it with the brg logic
This commit is contained in:
@@ -1377,7 +1377,6 @@ pub(crate) fn brg_visit_item(&mut self, item: &'a Item) {
|
||||
visit::walk_item(self, item);
|
||||
macro_rules_scope
|
||||
}
|
||||
ItemKind::MacCall(..) => self.visit_invoc_in_module(item.id),
|
||||
_ => {
|
||||
let orig_macro_rules_scope = self.parent_scope.macro_rules;
|
||||
self.build_reduced_graph_for_item(item);
|
||||
@@ -1402,8 +1401,10 @@ pub(crate) fn brg_visit_item(&mut self, item: &'a Item) {
|
||||
self.parent_scope.module = orig_module_scope;
|
||||
}
|
||||
|
||||
pub(crate) fn brg_visit_stmt_mac_call(&mut self, stmt: &'a ast::Stmt) {
|
||||
self.parent_scope.macro_rules = self.visit_invoc_in_module(stmt.id);
|
||||
/// Handle a macro call that itself can produce new `macro_rules` items
|
||||
/// in the current module.
|
||||
pub(crate) fn brg_visit_mac_call_in_module(&mut self, id: NodeId) {
|
||||
self.parent_scope.macro_rules = self.visit_invoc_in_module(id);
|
||||
}
|
||||
|
||||
pub(crate) fn brg_visit_block(&mut self, block: &'a Block) {
|
||||
|
||||
@@ -179,7 +179,7 @@ fn visit_item(&mut self, i: &'a Item) {
|
||||
}
|
||||
ItemKind::MacCall(..) => {
|
||||
self.visit_macro_invoc(i.id);
|
||||
self.brg_visit_item(i);
|
||||
self.brg_visit_mac_call_in_module(i.id);
|
||||
return;
|
||||
}
|
||||
ItemKind::DelegationMac(..) => unreachable!(),
|
||||
@@ -497,7 +497,7 @@ fn visit_ty(&mut self, ty: &'a Ty) {
|
||||
fn visit_stmt(&mut self, stmt: &'a Stmt) {
|
||||
match stmt.kind {
|
||||
StmtKind::MacCall(..) => {
|
||||
self.brg_visit_stmt_mac_call(stmt);
|
||||
self.brg_visit_mac_call_in_module(stmt.id);
|
||||
self.visit_macro_invoc(stmt.id)
|
||||
}
|
||||
// FIXME(impl_trait_in_bindings): We don't really have a good way of
|
||||
|
||||
Reference in New Issue
Block a user