@@ -1298,26 +1298,31 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
12981298 method ! ( visit_ty: ast:: Ty , ast:: TyKind :: MacCall , walk_ty) ;
12991299
13001300 fn visit_item ( & mut self , item : & ' b Item ) {
1301- let macro_use = match item. kind {
1301+ let orig_module_scope = self . parent_scope . module ;
1302+ self . parent_scope . macro_rules = match item. kind {
13021303 ItemKind :: MacroDef ( ..) => {
1303- self . parent_scope . macro_rules = self . define_macro ( item) ;
1304- return ;
1304+ let macro_rules_scope = self . define_macro ( item) ;
1305+ visit:: walk_item ( self , item) ;
1306+ macro_rules_scope
13051307 }
13061308 ItemKind :: MacCall ( ..) => {
1307- self . parent_scope . macro_rules = self . visit_invoc_in_module ( item. id ) ;
1308- return ;
1309+ let macro_rules_scope = self . visit_invoc_in_module ( item. id ) ;
1310+ visit:: walk_item ( self , item) ;
1311+ macro_rules_scope
1312+ }
1313+ _ => {
1314+ let orig_macro_rules_scope = self . parent_scope . macro_rules ;
1315+ self . build_reduced_graph_for_item ( item) ;
1316+ visit:: walk_item ( self , item) ;
1317+ match item. kind {
1318+ ItemKind :: Mod ( ..) if self . contains_macro_use ( & item. attrs ) => {
1319+ self . parent_scope . macro_rules
1320+ }
1321+ _ => orig_macro_rules_scope,
1322+ }
13091323 }
1310- ItemKind :: Mod ( ..) => self . contains_macro_use ( & item. attrs ) ,
1311- _ => false ,
13121324 } ;
1313- let orig_current_module = self . parent_scope . module ;
1314- let orig_current_macro_rules_scope = self . parent_scope . macro_rules ;
1315- self . build_reduced_graph_for_item ( item) ;
1316- visit:: walk_item ( self , item) ;
1317- self . parent_scope . module = orig_current_module;
1318- if !macro_use {
1319- self . parent_scope . macro_rules = orig_current_macro_rules_scope;
1320- }
1325+ self . parent_scope . module = orig_module_scope;
13211326 }
13221327
13231328 fn visit_stmt ( & mut self , stmt : & ' b ast:: Stmt ) {
0 commit comments