about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-01-13 15:28:49 -0800
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-01-14 18:15:54 -0800
commiteafed93d72845581e04bacd3aaea4b28a3f49396 (patch)
treedb06c066bac579039938a5a7774e0df627540a0d /src/libsyntax
parent1f5e9ff362042fe815fddfdaf211f782aa944229 (diff)
downloadrust-eafed93d72845581e04bacd3aaea4b28a3f49396.tar.gz
rust-eafed93d72845581e04bacd3aaea4b28a3f49396.zip
convert ast::struct_field_ into a struct
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs6
-rw-r--r--src/libsyntax/fold.rs24
-rw-r--r--src/libsyntax/parse/parser.rs10
3 files changed, 23 insertions, 17 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index c185fd36482..2d6c848be89 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1457,11 +1457,11 @@ impl visibility : cmp::Eq {
 
 #[auto_encode]
 #[auto_decode]
-type struct_field_ = {
+struct struct_field_ {
     kind: struct_field_kind,
     id: node_id,
-    ty: @Ty
-};
+    ty: @Ty,
+}
 
 type struct_field = spanned<struct_field_>;
 
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index c6a8bf7bd08..23c3694ebb2 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -216,9 +216,9 @@ fn noop_fold_item(&&i: @item, fld: ast_fold) -> Option<@item> {
 
 fn noop_fold_struct_field(&&sf: @struct_field, fld: ast_fold)
                        -> @struct_field {
-    @spanned { node: { kind: copy sf.node.kind,
-                       id: sf.node.id,
-                       ty: fld.fold_ty(sf.node.ty) },
+    @spanned { node: ast::struct_field_ { kind: copy sf.node.kind,
+                                          id: sf.node.id,
+                                          ty: fld.fold_ty(sf.node.ty) },
                span: sf.span }
 }
 
@@ -293,9 +293,9 @@ fn fold_trait_ref(&&p: @trait_ref, fld: ast_fold) -> @trait_ref {
 }
 
 fn fold_struct_field(&&f: @struct_field, fld: ast_fold) -> @struct_field {
-    @spanned { node: { kind: copy f.node.kind,
-                       id: fld.new_id(f.node.id),
-                       ty: fld.fold_ty(f.node.ty) },
+    @spanned { node: ast::struct_field_ { kind: copy f.node.kind,
+                                          id: fld.new_id(f.node.id),
+                                          ty: fld.fold_ty(f.node.ty) },
                span: fld.new_span(f.span) }
 }
 
@@ -693,10 +693,14 @@ impl ast_fold_fns: ast_fold {
         return (self.fold_item)(i, self as ast_fold);
     }
     fn fold_struct_field(&&sf: @struct_field) -> @struct_field {
-        @spanned { node: { kind: copy sf.node.kind,
-                           id: sf.node.id,
-                           ty: (self as ast_fold).fold_ty(sf.node.ty) },
-                   span: (self.new_span)(sf.span) }
+        @spanned {
+            node: ast::struct_field_ {
+                kind: copy sf.node.kind,
+                id: sf.node.id,
+                ty: (self as ast_fold).fold_ty(sf.node.ty),
+            },
+            span: (self.new_span)(sf.span),
+        }
     }
     fn fold_item_underscore(i: item_) ->
        item_ {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index db2d951eafe..f7651d31766 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2150,11 +2150,11 @@ impl Parser {
         let name = self.parse_ident();
         self.expect(token::COLON);
         let ty = self.parse_ty(false);
-        return @spanned(lo, self.last_span.hi, {
+        @spanned(lo, self.last_span.hi, ast::struct_field_ {
             kind: named_field(name, is_mutbl, pr),
             id: self.get_id(),
             ty: ty
-        });
+        })
     }
 
     fn parse_stmt(+first_item_attrs: ~[attribute]) -> @stmt {
@@ -2816,7 +2816,7 @@ impl Parser {
                                                  seq_sep_trailing_allowed
                                                     (token::COMMA)) |p| {
                 let lo = p.span.lo;
-                let struct_field_ = {
+                let struct_field_ = ast::struct_field_ {
                     kind: unnamed_field,
                     id: self.get_id(),
                     ty: p.parse_ty(false)
@@ -2893,7 +2893,9 @@ impl Parser {
             self.parse_method();
             // bogus value
             @spanned(self.span.lo, self.span.hi,
-                     { kind: unnamed_field, id: self.get_id(),
+                     ast::struct_field_ {
+                       kind: unnamed_field,
+                       id: self.get_id(),
                        ty: @{id: self.get_id(),
                              node: ty_nil,
                              span: copy self.span} })