about summary refs log tree commit diff
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-01-15 15:03:49 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-01-20 14:08:18 -0800
commit5ba7e55a4c42f6a53eccb60d4098b9422dd6e345 (patch)
treee14c312fe4142afe1528c43f0e306a8a61244864
parent8cdc3fda11b2e341f305c03678a04c6bb01ce635 (diff)
downloadrust-5ba7e55a4c42f6a53eccb60d4098b9422dd6e345.tar.gz
rust-5ba7e55a4c42f6a53eccb60d4098b9422dd6e345.zip
convert ast::{ty_field_,ty_method} into a struct
-rw-r--r--src/libsyntax/ast.rs18
-rw-r--r--src/libsyntax/ast_util.rs20
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs2
-rw-r--r--src/libsyntax/fold.rs10
-rw-r--r--src/libsyntax/parse/parser.rs18
5 files changed, 47 insertions, 21 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 4ae99d03c8d..953317fe02f 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -940,15 +940,25 @@ struct mt {
 
 #[auto_encode]
 #[auto_decode]
-type ty_field_ = {ident: ident, mt: mt};
+struct ty_field_ {
+    ident: ident,
+    mt: mt,
+}
 
 type ty_field = spanned<ty_field_>;
 
 #[auto_encode]
 #[auto_decode]
-type ty_method = {ident: ident, attrs: ~[attribute], purity: purity,
-                  decl: fn_decl, tps: ~[ty_param], self_ty: self_ty,
-                  id: node_id, span: span};
+struct ty_method {
+    ident: ident,
+    attrs: ~[attribute],
+    purity: purity,
+    decl: fn_decl,
+    tps: ~[ty_param],
+    self_ty: self_ty,
+    id: node_id,
+    span: span,
+}
 
 #[auto_encode]
 #[auto_decode]
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 0af9d2211be..a65d6467eb5 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -341,13 +341,19 @@ fn public_methods(ms: ~[@method]) -> ~[@method] {
 // a default, pull out the useful fields to make a ty_method
 fn trait_method_to_ty_method(method: trait_method) -> ty_method {
     match method {
-      required(ref m) => (*m),
-      provided(m) => {
-        {ident: m.ident, attrs: m.attrs,
-         purity: m.purity, decl: m.decl,
-         tps: m.tps, self_ty: m.self_ty,
-         id: m.id, span: m.span}
-      }
+        required(ref m) => (*m),
+        provided(m) => {
+            ty_method {
+                ident: m.ident,
+                attrs: m.attrs,
+                purity: m.purity,
+                decl: m.decl,
+                tps: m.tps,
+                self_ty: m.self_ty,
+                id: m.id,
+                span: m.span,
+            }
+        }
     }
 }
 
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 36ef9ac0cdf..0bd72790cad 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -167,7 +167,7 @@ impl ext_ctxt: ext_ctxt_ast_builder {
 
     fn ty_field_imm(name: ident, ty: @ast::Ty) -> ast::ty_field {
         spanned {
-            node: {
+            node: ast::ty_field_ {
                 ident: name,
                 mt: ast::mt { ty: ty, mutbl: ast::m_imm },
             },
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index aad6afbf434..e8d96d2e6e0 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -541,9 +541,13 @@ fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
         mt { ty: fld.fold_ty(mt.ty), mutbl: mt.mutbl }
     }
     fn fold_field(f: ty_field, fld: ast_fold) -> ty_field {
-        spanned { node: { ident: fld.fold_ident(f.node.ident),
-                          mt: fold_mt(f.node.mt, fld) },
-                  span: fld.new_span(f.span) }
+        spanned {
+            node: ast::ty_field_ {
+                ident: fld.fold_ident(f.node.ident),
+                mt: fold_mt(f.node.mt, fld),
+            },
+            span: fld.new_span(f.span),
+        }
     }
     match t {
       ty_nil | ty_bot | ty_infer => copy t,
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 2db9cdf3c30..b4fbd9beae3 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -421,10 +421,16 @@ impl Parser {
                 debug!("parse_trait_methods(): parsing required method");
                 // NB: at the moment, visibility annotations on required
                 // methods are ignored; this could change.
-                required({ident: ident, attrs: attrs,
-                          purity: pur, decl: d, tps: tps,
-                          self_ty: self_ty,
-                          id: p.get_id(), span: mk_sp(lo, hi)})
+                required(ty_method {
+                    ident: ident,
+                    attrs: attrs,
+                    purity: pur,
+                    decl: d,
+                    tps: tps,
+                    self_ty: self_ty,
+                    id: p.get_id(),
+                    span: mk_sp(lo, hi)
+                })
               }
               token::LBRACE => {
                 debug!("parse_trait_methods(): parsing provided method");
@@ -467,9 +473,9 @@ impl Parser {
         spanned(
             lo,
             ty.span.hi,
-            {
+            ast::ty_field_ {
                 ident: id,
-                mt: ast::mt { ty: ty, mutbl: mutbl }
+                mt: ast::mt { ty: ty, mutbl: mutbl },
             }
         )
     }