Skip to content

Commit eafed93

Browse files
committed
convert ast::struct_field_ into a struct
1 parent 1f5e9ff commit eafed93

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

src/libsyntax/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,11 +1457,11 @@ impl visibility : cmp::Eq {
14571457

14581458
#[auto_encode]
14591459
#[auto_decode]
1460-
type struct_field_ = {
1460+
struct struct_field_ {
14611461
kind: struct_field_kind,
14621462
id: node_id,
1463-
ty: @Ty
1464-
};
1463+
ty: @Ty,
1464+
}
14651465

14661466
type struct_field = spanned<struct_field_>;
14671467

src/libsyntax/fold.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ fn noop_fold_item(&&i: @item, fld: ast_fold) -> Option<@item> {
216216

217217
fn noop_fold_struct_field(&&sf: @struct_field, fld: ast_fold)
218218
-> @struct_field {
219-
@spanned { node: { kind: copy sf.node.kind,
220-
id: sf.node.id,
221-
ty: fld.fold_ty(sf.node.ty) },
219+
@spanned { node: ast::struct_field_ { kind: copy sf.node.kind,
220+
id: sf.node.id,
221+
ty: fld.fold_ty(sf.node.ty) },
222222
span: sf.span }
223223
}
224224

@@ -293,9 +293,9 @@ fn fold_trait_ref(&&p: @trait_ref, fld: ast_fold) -> @trait_ref {
293293
}
294294

295295
fn fold_struct_field(&&f: @struct_field, fld: ast_fold) -> @struct_field {
296-
@spanned { node: { kind: copy f.node.kind,
297-
id: fld.new_id(f.node.id),
298-
ty: fld.fold_ty(f.node.ty) },
296+
@spanned { node: ast::struct_field_ { kind: copy f.node.kind,
297+
id: fld.new_id(f.node.id),
298+
ty: fld.fold_ty(f.node.ty) },
299299
span: fld.new_span(f.span) }
300300
}
301301

@@ -693,10 +693,14 @@ impl ast_fold_fns: ast_fold {
693693
return (self.fold_item)(i, self as ast_fold);
694694
}
695695
fn fold_struct_field(&&sf: @struct_field) -> @struct_field {
696-
@spanned { node: { kind: copy sf.node.kind,
697-
id: sf.node.id,
698-
ty: (self as ast_fold).fold_ty(sf.node.ty) },
699-
span: (self.new_span)(sf.span) }
696+
@spanned {
697+
node: ast::struct_field_ {
698+
kind: copy sf.node.kind,
699+
id: sf.node.id,
700+
ty: (self as ast_fold).fold_ty(sf.node.ty),
701+
},
702+
span: (self.new_span)(sf.span),
703+
}
700704
}
701705
fn fold_item_underscore(i: item_) ->
702706
item_ {

src/libsyntax/parse/parser.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,11 +2150,11 @@ impl Parser {
21502150
let name = self.parse_ident();
21512151
self.expect(token::COLON);
21522152
let ty = self.parse_ty(false);
2153-
return @spanned(lo, self.last_span.hi, {
2153+
@spanned(lo, self.last_span.hi, ast::struct_field_ {
21542154
kind: named_field(name, is_mutbl, pr),
21552155
id: self.get_id(),
21562156
ty: ty
2157-
});
2157+
})
21582158
}
21592159
21602160
fn parse_stmt(+first_item_attrs: ~[attribute]) -> @stmt {
@@ -2816,7 +2816,7 @@ impl Parser {
28162816
seq_sep_trailing_allowed
28172817
(token::COMMA)) |p| {
28182818
let lo = p.span.lo;
2819-
let struct_field_ = {
2819+
let struct_field_ = ast::struct_field_ {
28202820
kind: unnamed_field,
28212821
id: self.get_id(),
28222822
ty: p.parse_ty(false)
@@ -2893,7 +2893,9 @@ impl Parser {
28932893
self.parse_method();
28942894
// bogus value
28952895
@spanned(self.span.lo, self.span.hi,
2896-
{ kind: unnamed_field, id: self.get_id(),
2896+
ast::struct_field_ {
2897+
kind: unnamed_field,
2898+
id: self.get_id(),
28972899
ty: @{id: self.get_id(),
28982900
node: ty_nil,
28992901
span: copy self.span} })

0 commit comments

Comments
 (0)