From 293cd3480c10855de68503db36c6cc3ce8988b54 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Mon, 14 Jan 2013 21:36:27 -0800 Subject: convert ast::{field_,capture_item_,mt} and middle::ty::mt into structs --- src/libsyntax/ext/auto_encode.rs | 10 +++++++--- src/libsyntax/ext/build.rs | 6 ++++-- src/libsyntax/ext/deriving.rs | 5 ++++- src/libsyntax/ext/pipes/ast_builder.rs | 15 +++++++++++---- 4 files changed, 26 insertions(+), 10 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index fcb11f42647..e241f6435d3 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -571,7 +571,7 @@ fn mk_ser_method( id: cx.next_id(), node: ast::re_anon, }, - { + ast::mt { ty: cx.ty_path(span, ~[cx.ident_of(~"__S")], ~[]), mutbl: ast::m_imm } @@ -634,7 +634,7 @@ fn mk_deser_method( id: cx.next_id(), node: ast::re_anon, }, - { + ast::mt { ty: cx.ty_path(span, ~[cx.ident_of(~"__D")], ~[]), mutbl: ast::m_imm } @@ -908,7 +908,11 @@ fn mk_deser_fields( ); ast::spanned { - node: { mutbl: field.mutbl, ident: field.ident, expr: expr }, + node: ast::field_ { + mutbl: field.mutbl, + ident: field.ident, + expr: expr, + }, span: span, } } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 72c13747bf1..cc4c58f3504 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -145,8 +145,10 @@ fn mk_uniq_str(cx: ext_ctxt, sp: span, s: ~str) -> @ast::expr { } fn mk_field(sp: span, f: &{ident: ast::ident, ex: @ast::expr}) -> ast::field { - ast::spanned { node: {mutbl: ast::m_imm, ident: f.ident, expr: f.ex}, - span: sp } + ast::spanned { + node: ast::field_ { mutbl: ast::m_imm, ident: f.ident, expr: f.ex }, + span: sp, + } } fn mk_fields(sp: span, fields: ~[{ident: ast::ident, ex: @ast::expr}]) -> ~[ast::field] { diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index 2148ad0cdb6..83d968bb2ac 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -136,7 +136,10 @@ fn create_eq_method(cx: ext_ctxt, type_ident, ty_params); let arg_region = @{ id: cx.next_id(), node: re_anon }; - let arg_type = ty_rptr(arg_region, { ty: arg_path_type, mutbl: m_imm }); + let arg_type = ty_rptr( + arg_region, + ast::mt { ty: arg_path_type, mutbl: m_imm } + ); let arg_type = @{ id: cx.next_id(), node: move arg_type, span: span }; // Create the `other` parameter. diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 29d27e53d68..19cbf833c0f 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -146,8 +146,10 @@ impl ext_ctxt: ext_ctxt_ast_builder { } fn field_imm(name: ident, e: @ast::expr) -> ast::field { - spanned { node: { mutbl: ast::m_imm, ident: name, expr: e }, - span: dummy_sp()} + spanned { + node: ast::field_ { mutbl: ast::m_imm, ident: name, expr: e }, + span: dummy_sp(), + } } fn rec(+fields: ~[ast::field]) -> @ast::expr { @@ -158,8 +160,13 @@ impl ext_ctxt: ext_ctxt_ast_builder { } fn ty_field_imm(name: ident, ty: @ast::Ty) -> ast::ty_field { - spanned { node: { ident: name, mt: { ty: ty, mutbl: ast::m_imm } }, - span: dummy_sp() } + spanned { + node: { + ident: name, + mt: ast::mt { ty: ty, mutbl: ast::m_imm }, + }, + span: dummy_sp(), + } } fn ty_rec(+fields: ~[ast::ty_field]) -> @ast::Ty { -- cgit 1.4.1-3-g733a5