@@ -24,7 +24,7 @@ trait ast_fold {
24
24
fn fold_view_item ( & & @view_item ) -> @view_item ;
25
25
fn fold_foreign_item ( & & @foreign_item ) -> @foreign_item ;
26
26
fn fold_item ( & & @item) -> option <@item>;
27
- fn fold_class_item ( & & @class_member ) -> @class_member ;
27
+ fn fold_struct_field ( & & @struct_field ) -> @struct_field ;
28
28
fn fold_item_underscore ( item_ ) -> item_ ;
29
29
fn fold_method ( & & @method ) -> @method ;
30
30
fn fold_block ( blk ) -> blk ;
@@ -55,7 +55,7 @@ type ast_fold_precursor = @{
55
55
fold_view_item: fn @( view_item_, ast_fold) -> view_item_,
56
56
fold_foreign_item: fn @( & & @foreign_item, ast_fold) -> @foreign_item,
57
57
fold_item: fn @( & & @item, ast_fold) -> option<@item>,
58
- fold_class_item : fn @( & & @class_member , ast_fold) -> @class_member ,
58
+ fold_struct_field : fn @( & & @struct_field , ast_fold) -> @struct_field ,
59
59
fold_item_underscore: fn @( item_, ast_fold) -> item_,
60
60
fold_method: fn @( & & @method, ast_fold) -> @method,
61
61
fold_block: fn @( blk_, span, ast_fold) -> ( blk_, span) ,
@@ -214,16 +214,12 @@ fn noop_fold_item(&&i: @item, fld: ast_fold) -> option<@item> {
214
214
span: fld. new_span ( i. span ) } ) ;
215
215
}
216
216
217
- fn noop_fold_class_item ( & & ci: @class_member , fld : ast_fold )
218
- -> @class_member {
219
- @{ node: match ci. node {
220
- instance_var( ident, t, cm, id, p) => {
221
- instance_var ( /* FIXME (#2543) */ copy ident,
222
- fld. fold_ty ( t) , cm, id, p)
223
- }
224
- class_method( m) => class_method ( fld. fold_method ( m) )
225
- } ,
226
- span: ci. span }
217
+ fn noop_fold_struct_field ( & & sf: @struct_field , fld : ast_fold )
218
+ -> @struct_field {
219
+ @{ node : { kind : copy sf. node . kind ,
220
+ id : sf. node . id ,
221
+ ty : fld. fold_ty ( sf. node . ty ) } ,
222
+ span: sf. span }
227
223
}
228
224
229
225
fn noop_fold_item_underscore ( i : item_ , fld : ast_fold ) -> item_ {
@@ -295,7 +291,8 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold)
295
291
with dtor} } ;
296
292
return @{
297
293
traits: vec:: map ( struct_def. traits , |p| fold_trait_ref ( p, fld) ) ,
298
- members: vec:: map ( struct_def. members , |x| fld. fold_class_item ( x) ) ,
294
+ fields: vec:: map ( struct_def. fields , |f| fold_struct_field ( f, fld) ) ,
295
+ methods: vec:: map ( struct_def. methods , |m| fld. fold_method ( m) ) ,
299
296
ctor: resulting_optional_constructor,
300
297
dtor: dtor
301
298
} ;
@@ -306,6 +303,13 @@ fn fold_trait_ref(&&p: @trait_ref, fld: ast_fold) -> @trait_ref {
306
303
impl_id: fld. new_id ( p. impl_id ) }
307
304
}
308
305
306
+ fn fold_struct_field ( & & f: @struct_field , fld : ast_fold ) -> @struct_field {
307
+ @{ node : { kind : copy f. node . kind ,
308
+ id : fld. new_id ( f. node . id ) ,
309
+ ty : fld. fold_ty ( f. node . ty ) } ,
310
+ span: fld. new_span ( f. span ) }
311
+ }
312
+
309
313
fn noop_fold_method ( & & m: @method , fld : ast_fold ) -> @method {
310
314
return @{ ident: fld. fold_ident ( m. ident ) ,
311
315
attrs: /* FIXME (#2543) */ copy m. attrs ,
@@ -570,8 +574,9 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ {
570
574
with dtor} } ;
571
575
kind = struct_variant_kind ( @{
572
576
traits: ~[ ] ,
573
- members: vec:: map ( struct_def. members ,
574
- |x| fld. fold_class_item ( x) ) ,
577
+ fields: vec:: map ( struct_def. fields ,
578
+ |f| fld. fold_struct_field ( f) ) ,
579
+ methods: vec:: map ( struct_def. methods , |m| fld. fold_method ( m) ) ,
575
580
ctor: none,
576
581
dtor: dtor
577
582
} )
@@ -644,7 +649,7 @@ fn default_ast_fold() -> ast_fold_precursor {
644
649
fold_view_item : noop_fold_view_item ,
645
650
fold_foreign_item : noop_fold_foreign_item ,
646
651
fold_item : noop_fold_item ,
647
- fold_class_item : noop_fold_class_item ,
652
+ fold_struct_field : noop_fold_struct_field ,
648
653
fold_item_underscore : noop_fold_item_underscore ,
649
654
fold_method : noop_fold_method ,
650
655
fold_block : wrap ( noop_fold_block ) ,
@@ -692,16 +697,11 @@ impl ast_fold_precursor: ast_fold {
692
697
fn fold_item( & & i: @item) -> option<@item> {
693
698
return self . fold_item ( i, self as ast_fold ) ;
694
699
}
695
- fn fold_class_item ( & & ci: @class_member ) -> @class_member {
696
- @{ node: match ci. node {
697
- instance_var( nm, t, mt, id, p) => {
698
- instance_var ( /* FIXME (#2543) */ copy nm,
699
- ( self as ast_fold ) . fold_ty ( t) , mt, id, p)
700
- }
701
- class_method( m) => {
702
- class_method ( self . fold_method ( m, self as ast_fold ) )
703
- }
704
- } , span: self . new_span ( ci. span ) }
700
+ fn fold_struct_field ( & & sf: @struct_field ) -> @struct_field {
701
+ @{ node : { kind : copy sf. node . kind ,
702
+ id : sf. node . id ,
703
+ ty : ( self as ast_fold ) . fold_ty ( sf. node . ty ) } ,
704
+ span: self . new_span ( sf. span ) }
705
705
}
706
706
fn fold_item_underscore ( i : item_ ) ->
707
707
item_ {
0 commit comments