about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-01-15 14:59:39 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-01-20 14:08:18 -0800
commit8cdc3fda11b2e341f305c03678a04c6bb01ce635 (patch)
tree203eb55d29526de6c6148fd603d94d597165334c /src/libsyntax/ext
parent8a3a1fc1489fb1f313fdd75af4e73a6a3b271ce2 (diff)
downloadrust-8cdc3fda11b2e341f305c03678a04c6bb01ce635.tar.gz
rust-8cdc3fda11b2e341f305c03678a04c6bb01ce635.zip
convert ast::ty into a struct
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/auto_encode.rs37
-rw-r--r--src/libsyntax/ext/build.rs6
-rw-r--r--src/libsyntax/ext/deriving.rs16
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs32
4 files changed, 56 insertions, 35 deletions
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index 625c04a6463..aa577591804 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -130,7 +130,10 @@ fn expand_auto_encode(
     do vec::flat_map(in_items) |item| {
         if item.attrs.any(is_auto_encode) {
             match item.node {
-                ast::item_ty(@{node: ast::ty_rec(ref fields), _}, tps) => {
+                ast::item_ty(
+                    @ast::Ty {node: ast::ty_rec(ref fields), _},
+                    tps
+                ) => {
                     let ser_impl = mk_rec_ser_impl(
                         cx,
                         item.span,
@@ -196,7 +199,10 @@ fn expand_auto_decode(
     do vec::flat_map(in_items) |item| {
         if item.attrs.any(is_auto_decode) {
             match item.node {
-                ast::item_ty(@{node: ast::ty_rec(ref fields), _}, tps) => {
+                ast::item_ty(
+                    @ast::Ty {node: ast::ty_rec(ref fields), _},
+                    tps
+                ) => {
                     let deser_impl = mk_rec_deser_impl(
                         cx,
                         item.span,
@@ -249,7 +255,7 @@ priv impl ext_ctxt {
         path: @ast::path,
         bounds: @~[ast::ty_param_bound]
     ) -> ast::ty_param {
-        let bound = ast::TraitTyParamBound(@{
+        let bound = ast::TraitTyParamBound(@ast::Ty {
             id: self.next_id(),
             node: ast::ty_path(path, self.next_id()),
             span: span,
@@ -315,9 +321,13 @@ priv impl ext_ctxt {
 
     fn ty_path(span: span, strs: ~[ast::ident],
                tps: ~[@ast::Ty]) -> @ast::Ty {
-        @{id: self.next_id(),
-          node: ast::ty_path(self.path_tps(span, strs, tps), self.next_id()),
-          span: span}
+        @ast::Ty {
+            id: self.next_id(),
+            node: ast::ty_path(
+                self.path_tps(span, strs, tps),
+                self.next_id()),
+            span: span,
+        }
     }
 
     fn binder_pat(span: span, nm: ast::ident) -> @ast::pat {
@@ -438,7 +448,7 @@ fn mk_impl(
     let mut trait_tps = vec::append(
         ~[ty_param],
          do tps.map |tp| {
-            let t_bound = ast::TraitTyParamBound(@{
+            let t_bound = ast::TraitTyParamBound(@ast::Ty {
                 id: cx.next_id(),
                 node: ast::ty_path(path, cx.next_id()),
                 span: span,
@@ -568,7 +578,7 @@ fn mk_ser_method(
     span: span,
     ser_body: ast::blk
 ) -> @ast::method {
-    let ty_s = @{
+    let ty_s = @ast::Ty {
         id: cx.next_id(),
         node: ast::ty_rptr(
             @{
@@ -597,7 +607,7 @@ fn mk_ser_method(
         id: cx.next_id(),
     }];
 
-    let ser_output = @{
+    let ser_output = @ast::Ty {
         id: cx.next_id(),
         node: ast::ty_nil,
         span: span,
@@ -631,7 +641,7 @@ fn mk_deser_method(
     ty: @ast::Ty,
     deser_body: ast::blk
 ) -> @ast::method {
-    let ty_d = @{
+    let ty_d = @ast::Ty {
         id: cx.next_id(),
         node: ast::ty_rptr(
             @{
@@ -670,8 +680,7 @@ fn mk_deser_method(
         ident: cx.ident_of(~"decode"),
         attrs: ~[],
         tps: ~[],
-        self_ty: ast::spanned { node: ast::sty_static,
-                                span: span },
+        self_ty: ast::spanned { node: ast::sty_static, span: span },
         purity: ast::impure_fn,
         decl: deser_decl,
         body: deser_body,
@@ -1181,7 +1190,7 @@ fn mk_enum_deser_body(
             {
                 inputs: ~[{
                     mode: ast::infer(cx.next_id()),
-                    ty: @{
+                    ty: @ast::Ty {
                         id: cx.next_id(),
                         node: ast::ty_infer,
                         span: span
@@ -1196,7 +1205,7 @@ fn mk_enum_deser_body(
                     },
                     id: cx.next_id(),
                 }],
-                output: @{
+                output: @ast::Ty {
                     id: cx.next_id(),
                     node: ast::ty_infer,
                     span: span,
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index a4184bdfda7..20f2f16058f 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -194,7 +194,7 @@ fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
             None),
         span: sp,
     };
-    let ty : @ast::Ty = @{ id: cx.next_id(), node: ast::ty_infer, span: sp };
+    let ty = @ast::Ty { id: cx.next_id(), node: ast::ty_infer, span: sp };
     let local = @ast::spanned {
         node: ast::local_ {
             is_mutbl: mutbl,
@@ -293,7 +293,7 @@ fn mk_ty_path(cx: ext_ctxt,
            -> @ast::Ty {
     let ty = build::mk_raw_path(span, idents);
     let ty = ast::ty_path(ty, cx.next_id());
-    let ty = @{ id: cx.next_id(), node: move ty, span: span };
+    let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span };
     ty
 }
 fn mk_ty_path_global(cx: ext_ctxt,
@@ -302,7 +302,7 @@ fn mk_ty_path_global(cx: ext_ctxt,
                   -> @ast::Ty {
     let ty = build::mk_raw_path_global(span, idents);
     let ty = ast::ty_path(ty, cx.next_id());
-    let ty = @{ id: cx.next_id(), node: move ty, span: span };
+    let ty = @ast::Ty { id: cx.next_id(), node: move ty, span: span };
     ty
 }
 fn mk_simple_ty_path(cx: ext_ctxt,
diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs
index 83d968bb2ac..b272348244d 100644
--- a/src/libsyntax/ext/deriving.rs
+++ b/src/libsyntax/ext/deriving.rs
@@ -140,7 +140,11 @@ fn create_eq_method(cx: ext_ctxt,
         arg_region,
         ast::mt { ty: arg_path_type, mutbl: m_imm }
     );
-    let arg_type = @{ id: cx.next_id(), node: move arg_type, span: span };
+    let arg_type = @ast::Ty {
+        id: cx.next_id(),
+        node: arg_type,
+        span: span,
+    };
 
     // Create the `other` parameter.
     let other_ident = cx.ident_of(~"__other");
@@ -150,10 +154,10 @@ fn create_eq_method(cx: ext_ctxt,
     let bool_ident = cx.ident_of(~"bool");
     let output_type = build::mk_raw_path(span, ~[ bool_ident ]);
     let output_type = ty_path(output_type, cx.next_id());
-    let output_type = @{
+    let output_type = @ast::Ty {
         id: cx.next_id(),
-        node: move output_type,
-        span: span
+        node: output_type,
+        span: span,
     };
 
     // Create the function declaration.
@@ -199,7 +203,7 @@ fn create_self_type_with_params(cx: ext_ctxt,
                                         ~[ type_ident ],
                                         move self_ty_params);
     let self_type = ty_path(self_type, cx.next_id());
-    @{ id: cx.next_id(), node: move self_type, span: span }
+    @ast::Ty { id: cx.next_id(), node: self_type, span: span }
 }
 
 fn create_derived_impl(cx: ext_ctxt,
@@ -303,7 +307,7 @@ fn create_iter_bytes_method(cx: ext_ctxt,
     let f_arg = build::mk_arg(cx, span, f_ident, f_arg_type);
 
     // Create the type of the return value.
-    let output_type = @{ id: cx.next_id(), node: ty_nil, span: span };
+    let output_type = @ast::Ty { id: cx.next_id(), node: ty_nil, span: span };
 
     // Create the function declaration.
     let inputs = ~[ move lsb0_arg, move f_arg ];
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 8472e61c196..36ef9ac0cdf 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -176,15 +176,19 @@ impl ext_ctxt: ext_ctxt_ast_builder {
     }
 
     fn ty_rec(+fields: ~[ast::ty_field]) -> @ast::Ty {
-        @{id: self.next_id(),
-          node: ast::ty_rec(fields),
-          span: dummy_sp()}
+        @ast::Ty {
+            id: self.next_id(),
+            node: ast::ty_rec(fields),
+            span: dummy_sp(),
+        }
     }
 
     fn ty_infer() -> @ast::Ty {
-        @{id: self.next_id(),
-          node: ast::ty_infer,
-          span: dummy_sp()}
+        @ast::Ty {
+            id: self.next_id(),
+            node: ast::ty_infer,
+            span: dummy_sp(),
+        }
     }
 
     fn ty_param(id: ast::ident, +bounds: ~[ast::ty_param_bound])
@@ -340,15 +344,19 @@ impl ext_ctxt: ext_ctxt_ast_builder {
     }
 
     fn ty_path_ast_builder(path: @ast::path) -> @ast::Ty {
-        @{id: self.next_id(),
-          node: ast::ty_path(path, self.next_id()),
-          span: path.span}
+        @ast::Ty {
+            id: self.next_id(),
+            node: ast::ty_path(path, self.next_id()),
+            span: path.span,
+        }
     }
 
     fn ty_nil_ast_builder() -> @ast::Ty {
-        @{id: self.next_id(),
-          node: ast::ty_nil,
-          span: dummy_sp()}
+        @ast::Ty {
+            id: self.next_id(),
+            node: ast::ty_nil,
+            span: dummy_sp(),
+        }
     }
 
     fn item_ty_poly(name: ident,