@@ -1298,26 +1298,31 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
1298
1298
method ! ( visit_ty: ast:: Ty , ast:: TyKind :: MacCall , walk_ty) ;
1299
1299
1300
1300
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 {
1302
1303
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
1305
1307
}
1306
1308
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
+ }
1309
1323
}
1310
- ItemKind :: Mod ( ..) => self . contains_macro_use ( & item. attrs ) ,
1311
- _ => false ,
1312
1324
} ;
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;
1321
1326
}
1322
1327
1323
1328
fn visit_stmt ( & mut self , stmt : & ' b ast:: Stmt ) {
0 commit comments