diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-01-15 16:05:20 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-01-20 14:08:18 -0800 |
| commit | d5d77b9351bdcb7a9fd7c6a27950990d33eea232 (patch) | |
| tree | d5d51cb523cbdd41ce069d1c4478437bf1cfff5b /src/libsyntax/ext | |
| parent | 5ba7e55a4c42f6a53eccb60d4098b9422dd6e345 (diff) | |
| download | rust-d5d77b9351bdcb7a9fd7c6a27950990d33eea232.tar.gz rust-d5d77b9351bdcb7a9fd7c6a27950990d33eea232.zip | |
convert the remaining ast record types into structs
These are: region,arg,fn_decl,method,_mod,foreign_mod, variant_arg,enum_def_,variant_,trait_ref.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/auto_encode.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 46 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 15 |
6 files changed, 57 insertions, 42 deletions
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index aa577591804..9578a2f6317 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -462,7 +462,7 @@ fn mk_impl( } ); - let opt_trait = Some(@{ + let opt_trait = Some(@ast::trait_ref { path: path, ref_id: cx.next_id(), }); @@ -581,7 +581,7 @@ fn mk_ser_method( let ty_s = @ast::Ty { id: cx.next_id(), node: ast::ty_rptr( - @{ + @ast::region { id: cx.next_id(), node: ast::re_anon, }, @@ -593,7 +593,7 @@ fn mk_ser_method( span: span, }; - let ser_inputs = ~[{ + let ser_inputs = ~[ast::arg { mode: ast::infer(cx.next_id()), ty: ty_s, pat: @ast::pat { @@ -613,13 +613,13 @@ fn mk_ser_method( span: span, }; - let ser_decl = { + let ser_decl = ast::fn_decl { inputs: ser_inputs, output: ser_output, cf: ast::return_val, }; - @{ + @ast::method { ident: cx.ident_of(~"encode"), attrs: ~[], tps: ~[], @@ -644,7 +644,7 @@ fn mk_deser_method( let ty_d = @ast::Ty { id: cx.next_id(), node: ast::ty_rptr( - @{ + @ast::region { id: cx.next_id(), node: ast::re_anon, }, @@ -656,7 +656,7 @@ fn mk_deser_method( span: span, }; - let deser_inputs = ~[{ + let deser_inputs = ~[ast::arg { mode: ast::infer(cx.next_id()), ty: ty_d, pat: @ast::pat { @@ -670,13 +670,13 @@ fn mk_deser_method( id: cx.next_id(), }]; - let deser_decl = { + let deser_decl = ast::fn_decl { inputs: deser_inputs, output: ty, cf: ast::return_val, }; - @{ + @ast::method { ident: cx.ident_of(~"decode"), attrs: ~[], tps: ~[], @@ -1187,8 +1187,8 @@ fn mk_enum_deser_body( let expr_lambda = cx.expr( span, ast::expr_fn_block( - { - inputs: ~[{ + ast::fn_decl { + inputs: ~[ast::arg { mode: ast::infer(cx.next_id()), ty: @ast::Ty { id: cx.next_id(), diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 20f2f16058f..d17db9ad6aa 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -317,7 +317,7 @@ fn mk_arg(cx: ext_ctxt, ty: @ast::Ty) -> ast::arg { let arg_pat = mk_pat_ident(cx, span, ident); - { + ast::arg { mode: ast::infer(cx.next_id()), ty: ty, pat: arg_pat, @@ -325,7 +325,7 @@ fn mk_arg(cx: ext_ctxt, } } fn mk_fn_decl(+inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl { - { inputs: move inputs, output: output, cf: ast::return_val } + ast::fn_decl { inputs: inputs, output: output, cf: ast::return_val } } fn mk_ty_param(cx: ext_ctxt, ident: ast::ident, diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index b272348244d..d7059fc1977 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -135,7 +135,7 @@ fn create_eq_method(cx: ext_ctxt, span, type_ident, ty_params); - let arg_region = @{ id: cx.next_id(), node: re_anon }; + let arg_region = @ast::region { id: cx.next_id(), node: re_anon }; let arg_type = ty_rptr( arg_region, ast::mt { ty: arg_path_type, mutbl: m_imm } @@ -168,7 +168,7 @@ fn create_eq_method(cx: ext_ctxt, // Create the method. let self_ty = spanned { node: sty_region(m_imm), span: span }; - return @{ + @ast::method { ident: method_ident, attrs: ~[], tps: ~[], @@ -180,7 +180,7 @@ fn create_eq_method(cx: ext_ctxt, span: span, self_id: cx.next_id(), vis: public - }; + } } fn create_self_type_with_params(cx: ext_ctxt, @@ -234,7 +234,7 @@ fn create_derived_impl(cx: ext_ctxt, types: ~[] }; let trait_path = @move trait_path; - let trait_ref = { + let trait_ref = ast::trait_ref { path: trait_path, ref_id: cx.next_id() }; @@ -319,7 +319,7 @@ fn create_iter_bytes_method(cx: ext_ctxt, // Create the method. let self_ty = spanned { node: sty_region(m_imm), span: span }; let method_ident = cx.ident_of(~"iter_bytes"); - return @{ + @ast::method { ident: method_ident, attrs: ~[], tps: ~[], diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 11abec941e8..eb571b99b4e 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -119,7 +119,7 @@ fn expand_mod_items(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt, } }; - return {items: new_items, ..module_}; + ast::_mod { items: new_items, ..module_ } } diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 0bd72790cad..c8c05d27d80 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -198,7 +198,7 @@ impl ext_ctxt: ext_ctxt_ast_builder { } fn arg(name: ident, ty: @ast::Ty) -> ast::arg { - { + ast::arg { mode: ast::infer(self.next_id()), ty: ty, pat: @ast::pat { @@ -231,9 +231,11 @@ impl ext_ctxt: ext_ctxt_ast_builder { fn fn_decl(+inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl { - {inputs: inputs, - output: output, - cf: ast::return_val} + ast::fn_decl { + inputs: inputs, + output: output, + cf: ast::return_val, + } } fn item(name: ident, @@ -295,15 +297,20 @@ impl ext_ctxt: ext_ctxt_ast_builder { fn variant(name: ident, span: span, +tys: ~[@ast::Ty]) -> ast::variant { - let args = tys.map(|ty| {ty: *ty, id: self.next_id()}); - - spanned { node: { name: name, - attrs: ~[], - kind: ast::tuple_variant_kind(args), - id: self.next_id(), - disr_expr: None, - vis: ast::public}, - span: span} + let args = do tys.map |ty| { + ast::variant_arg { ty: *ty, id: self.next_id() } + }; + + spanned { + node: ast::variant_ { + name: name, + attrs: ~[], + kind: ast::tuple_variant_kind(args), + id: self.next_id(), + disr_expr: None, + vis: ast::public}, + span: span, + } } fn item_mod(name: ident, @@ -336,11 +343,14 @@ impl ext_ctxt: ext_ctxt_ast_builder { span: ast_util::dummy_sp() }; - self.item(name, - span, - ast::item_mod({ - view_items: ~[vi], - items: items})) + self.item( + name, + span, + ast::item_mod(ast::_mod { + view_items: ~[vi], + items: items, + }) + ) } fn ty_path_ast_builder(path: @ast::path) -> @ast::Ty { diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index e88ddb841be..306df24e79f 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -240,11 +240,16 @@ impl state: to_type_decls { items_msg.push(v); } - ~[cx.item_enum_poly(name, - self.span, - ast::enum_def({ variants: items_msg, - common: None }), - self.ty_params)] + ~[ + cx.item_enum_poly( + name, + self.span, + ast::enum_def(enum_def_ { + variants: items_msg, + common: None }), + self.ty_params + ) + ] } fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> ~[@ast::item] { |
