@@ -658,8 +658,7 @@ mod collect {
658
658
ret result;
659
659
}
660
660
661
- fn collect( & @ty_item_table id_to_ty_item, & @ast:: item i)
662
- -> @ty_item_table {
661
+ fn collect( & @ty_item_table id_to_ty_item, & @ast:: item i) {
663
662
alt ( i. node) {
664
663
case ( ast:: item_ty( _, _, _, ?def_id, _) ) {
665
664
id_to_ty_item. insert( def_id, any_item_rust( i) ) ;
@@ -672,22 +671,17 @@ mod collect {
672
671
}
673
672
case ( _) { /* empty */ }
674
673
}
675
- ret id_to_ty_item;
676
674
}
677
675
678
- fn collect_native( & @ty_item_table id_to_ty_item, & @ast:: native_item i)
679
- -> @ty_item_table {
676
+ fn collect_native( & @ty_item_table id_to_ty_item, & @ast:: native_item i) {
680
677
alt ( i. node) {
681
678
case ( ast:: native_item_ty( _, ?def_id) ) {
682
679
// The abi of types is not used.
683
680
id_to_ty_item. insert( def_id,
684
- any_item_native( i,
685
- ast:: native_abi_cdecl) ) ;
686
- }
687
- case ( _) {
681
+ any_item_native( i, ast:: native_abi_cdecl) ) ;
688
682
}
683
+ case ( _) { /* no-op */ }
689
684
}
690
- ret id_to_ty_item;
691
685
}
692
686
693
687
fn convert( & @env e, & @ast:: item i) -> @env {
@@ -884,11 +878,12 @@ mod collect {
884
878
vec( mutable) ;
885
879
let node_type_table ntt = @mutable ntt_sub;
886
880
887
- auto fld_1 = fold:: new_identity_fold[ @ty_item_table] ( ) ;
888
- fld_1 = @rec( update_env_for_item = bind collect( _, _) ,
889
- update_env_for_native_item = bind collect_native( _, _)
890
- with * fld_1) ;
891
- fold:: fold_crate[ @ty_item_table] ( id_to_ty_item, fld_1, crate ) ;
881
+ auto visit = rec(
882
+ visit_item_pre = bind collect( id_to_ty_item, _) ,
883
+ visit_native_item_pre = bind collect_native( id_to_ty_item, _)
884
+ with walk:: default_visitor( )
885
+ ) ;
886
+ walk:: walk_crate( visit, * crate ) ;
892
887
893
888
// Second pass: translate the types of all items.
894
889
auto type_cache = common:: new_def_hash[ ty:: ty_param_count_and_ty] ( ) ;
0 commit comments