diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-09-02 03:45:37 +0200 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-09-03 14:45:06 +0200 |
| commit | 74190853373c7963d933e2fb5c2ac2f761fdbc02 (patch) | |
| tree | 12ffa50679235aab28c7bf26799504d7ac8b8ac6 /src/libsyntax/ext | |
| parent | 58decdd7a115f2892d63fa3760fa2125eb784ac8 (diff) | |
| download | rust-74190853373c7963d933e2fb5c2ac2f761fdbc02.tar.gz rust-74190853373c7963d933e2fb5c2ac2f761fdbc02.zip | |
Modernized a few more types in syntax::ast
Diffstat (limited to 'src/libsyntax/ext')
24 files changed, 397 insertions, 397 deletions
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index e023c0c67ed..3937cd8e416 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -75,10 +75,10 @@ pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) let out = p.parse_expr(); p.expect(&token::RPAREN); - let out = @ast::expr { + let out = @ast::Expr { id: cx.next_id(), span: out.span, - node: ast::expr_addr_of(ast::m_mutbl, out) + node: ast::ExprAddrOf(ast::MutMutable, out) }; outputs.push((constraint, out)); @@ -171,9 +171,9 @@ pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) } } - MRExpr(@ast::expr { + MRExpr(@ast::Expr { id: cx.next_id(), - node: ast::expr_inline_asm(ast::inline_asm { + node: ast::ExprInlineAsm(ast::inline_asm { asm: asm, clobbers: cons.to_managed(), inputs: inputs, diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 913b68da0cb..50683358f87 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -62,11 +62,11 @@ pub type SyntaxExpanderTTItemFun = @fn(@ExtCtxt, -> MacResult; pub enum MacResult { - MRExpr(@ast::expr), + MRExpr(@ast::Expr), MRItem(@ast::item), - MRAny(@fn() -> @ast::expr, + MRAny(@fn() -> @ast::Expr, @fn() -> Option<@ast::item>, - @fn() -> @ast::stmt), + @fn() -> @ast::Stmt), MRDef(MacroDef) } @@ -319,9 +319,9 @@ impl ExtCtxt { } } -pub fn expr_to_str(cx: @ExtCtxt, expr: @ast::expr, err_msg: &str) -> @str { +pub fn expr_to_str(cx: @ExtCtxt, expr: @ast::Expr, err_msg: &str) -> @str { match expr.node { - ast::expr_lit(l) => match l.node { + ast::ExprLit(l) => match l.node { ast::lit_str(s) => s, _ => cx.span_fatal(l.span, err_msg) }, @@ -353,7 +353,7 @@ pub fn get_single_str_from_tts(cx: @ExtCtxt, pub fn get_exprs_from_tts(cx: @ExtCtxt, sp: Span, - tts: &[ast::token_tree]) -> ~[@ast::expr] { + tts: &[ast::token_tree]) -> ~[@ast::Expr] { let p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.to_owned()); diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 55f7a35e1df..339583ed426 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -21,7 +21,7 @@ use opt_vec::OptVec; pub struct Field { ident: ast::Ident, - ex: @ast::expr + ex: @ast::Expr } // Transitional reexports so qquote can find the paths it is looking for @@ -43,7 +43,7 @@ pub trait AstBuilder { -> ast::Path; // types - fn ty_mt(&self, ty: ast::Ty, mutbl: ast::mutability) -> ast::mt; + fn ty_mt(&self, ty: ast::Ty, mutbl: ast::Mutability) -> ast::mt; fn ty(&self, span: Span, ty: ast::ty_) -> ast::Ty; fn ty_path(&self, ast::Path, Option<OptVec<ast::TyParamBound>>) -> ast::Ty; @@ -52,9 +52,9 @@ pub trait AstBuilder { fn ty_rptr(&self, span: Span, ty: ast::Ty, lifetime: Option<ast::Lifetime>, - mutbl: ast::mutability) -> ast::Ty; + mutbl: ast::Mutability) -> ast::Ty; fn ty_uniq(&self, span: Span, ty: ast::Ty) -> ast::Ty; - fn ty_box(&self, span: Span, ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty; + fn ty_box(&self, span: Span, ty: ast::Ty, mutbl: ast::Mutability) -> ast::Ty; fn ty_option(&self, ty: ast::Ty) -> ast::Ty; fn ty_infer(&self, sp: Span) -> ast::Ty; @@ -72,101 +72,101 @@ pub trait AstBuilder { fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime; // statements - fn stmt_expr(&self, expr: @ast::expr) -> @ast::stmt; - fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: @ast::expr) -> @ast::stmt; + fn stmt_expr(&self, expr: @ast::Expr) -> @ast::Stmt; + fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: @ast::Expr) -> @ast::Stmt; fn stmt_let_typed(&self, sp: Span, mutbl: bool, ident: ast::Ident, typ: ast::Ty, - ex: @ast::expr) - -> @ast::stmt; + ex: @ast::Expr) + -> @ast::Stmt; // blocks - fn block(&self, span: Span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block; - fn block_expr(&self, expr: @ast::expr) -> ast::Block; + fn block(&self, span: Span, stmts: ~[@ast::Stmt], expr: Option<@ast::Expr>) -> ast::Block; + fn block_expr(&self, expr: @ast::Expr) -> ast::Block; fn block_all(&self, span: Span, view_items: ~[ast::view_item], - stmts: ~[@ast::stmt], - expr: Option<@ast::expr>) -> ast::Block; + stmts: ~[@ast::Stmt], + expr: Option<@ast::Expr>) -> ast::Block; // expressions - fn expr(&self, span: Span, node: ast::expr_) -> @ast::expr; - fn expr_path(&self, path: ast::Path) -> @ast::expr; - fn expr_ident(&self, span: Span, id: ast::Ident) -> @ast::expr; - - fn expr_self(&self, span: Span) -> @ast::expr; - fn expr_binary(&self, sp: Span, op: ast::binop, - lhs: @ast::expr, rhs: @ast::expr) -> @ast::expr; - fn expr_deref(&self, sp: Span, e: @ast::expr) -> @ast::expr; - fn expr_unary(&self, sp: Span, op: ast::unop, e: @ast::expr) -> @ast::expr; - - fn expr_managed(&self, sp: Span, e: @ast::expr) -> @ast::expr; - fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr; - fn expr_mut_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr; - fn expr_field_access(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr; - fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr; - fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::expr]) -> @ast::expr; + fn expr(&self, span: Span, node: ast::Expr_) -> @ast::Expr; + fn expr_path(&self, path: ast::Path) -> @ast::Expr; + fn expr_ident(&self, span: Span, id: ast::Ident) -> @ast::Expr; + + fn expr_self(&self, span: Span) -> @ast::Expr; + fn expr_binary(&self, sp: Span, op: ast::BinOp, + lhs: @ast::Expr, rhs: @ast::Expr) -> @ast::Expr; + fn expr_deref(&self, sp: Span, e: @ast::Expr) -> @ast::Expr; + fn expr_unary(&self, sp: Span, op: ast::UnOp, e: @ast::Expr) -> @ast::Expr; + + fn expr_managed(&self, sp: Span, e: @ast::Expr) -> @ast::Expr; + fn expr_addr_of(&self, sp: Span, e: @ast::Expr) -> @ast::Expr; + fn expr_mut_addr_of(&self, sp: Span, e: @ast::Expr) -> @ast::Expr; + fn expr_field_access(&self, span: Span, expr: @ast::Expr, ident: ast::Ident) -> @ast::Expr; + fn expr_call(&self, span: Span, expr: @ast::Expr, args: ~[@ast::Expr]) -> @ast::Expr; + fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::Expr]) -> @ast::Expr; fn expr_call_global(&self, sp: Span, fn_path: ~[ast::Ident], - args: ~[@ast::expr]) -> @ast::expr; + args: ~[@ast::Expr]) -> @ast::Expr; fn expr_method_call(&self, span: Span, - expr: @ast::expr, ident: ast::Ident, - args: ~[@ast::expr]) -> @ast::expr; - fn expr_block(&self, b: ast::Block) -> @ast::expr; + expr: @ast::Expr, ident: ast::Ident, + args: ~[@ast::Expr]) -> @ast::Expr; + fn expr_block(&self, b: ast::Block) -> @ast::Expr; - fn field_imm(&self, span: Span, name: Ident, e: @ast::expr) -> ast::Field; - fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr; - fn expr_struct_ident(&self, span: Span, id: ast::Ident, fields: ~[ast::Field]) -> @ast::expr; + fn field_imm(&self, span: Span, name: Ident, e: @ast::Expr) -> ast::Field; + fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::Expr; + fn expr_struct_ident(&self, span: Span, id: ast::Ident, fields: ~[ast::Field]) -> @ast::Expr; - fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::expr; + fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::Expr; - fn expr_uint(&self, span: Span, i: uint) -> @ast::expr; - fn expr_int(&self, sp: Span, i: int) -> @ast::expr; - fn expr_u8(&self, sp: Span, u: u8) -> @ast::expr; - fn expr_bool(&self, sp: Span, value: bool) -> @ast::expr; + fn expr_uint(&self, span: Span, i: uint) -> @ast::Expr; + fn expr_int(&self, sp: Span, i: int) -> @ast::Expr; + fn expr_u8(&self, sp: Span, u: u8) -> @ast::Expr; + fn expr_bool(&self, sp: Span, value: bool) -> @ast::Expr; - fn expr_vstore(&self, sp: Span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr; - fn expr_vec(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr; - fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr; - fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr; - fn expr_str(&self, sp: Span, s: @str) -> @ast::expr; - fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::expr; + fn expr_vstore(&self, sp: Span, expr: @ast::Expr, vst: ast::ExprVstore) -> @ast::Expr; + fn expr_vec(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr; + fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr; + fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr; + fn expr_str(&self, sp: Span, s: @str) -> @ast::Expr; + fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::Expr; - fn expr_unreachable(&self, span: Span) -> @ast::expr; + fn expr_unreachable(&self, span: Span) -> @ast::Expr; - fn pat(&self, span: Span, pat: ast::pat_) -> @ast::pat; - fn pat_wild(&self, span: Span) -> @ast::pat; - fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat; - fn pat_ident(&self, span: Span, ident: ast::Ident) -> @ast::pat; + fn pat(&self, span: Span, pat: ast::Pat_) -> @ast::Pat; + fn pat_wild(&self, span: Span) -> @ast::Pat; + fn pat_lit(&self, span: Span, expr: @ast::Expr) -> @ast::Pat; + fn pat_ident(&self, span: Span, ident: ast::Ident) -> @ast::Pat; fn pat_ident_binding_mode(&self, span: Span, ident: ast::Ident, - bm: ast::binding_mode) -> @ast::pat; - fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat; + bm: ast::BindingMode) -> @ast::Pat; + fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::Pat]) -> @ast::Pat; fn pat_struct(&self, span: Span, - path: ast::Path, field_pats: ~[ast::field_pat]) -> @ast::pat; + path: ast::Path, field_pats: ~[ast::FieldPat]) -> @ast::Pat; - fn arm(&self, span: Span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm; - fn arm_unreachable(&self, span: Span) -> ast::arm; + fn arm(&self, span: Span, pats: ~[@ast::Pat], expr: @ast::Expr) -> ast::Arm; + fn arm_unreachable(&self, span: Span) -> ast::Arm; - fn expr_match(&self, span: Span, arg: @ast::expr, arms: ~[ast::arm]) -> @ast::expr; + fn expr_match(&self, span: Span, arg: @ast::Expr, arms: ~[ast::Arm]) -> @ast::Expr; fn expr_if(&self, span: Span, - cond: @ast::expr, then: @ast::expr, els: Option<@ast::expr>) -> @ast::expr; + cond: @ast::Expr, then: @ast::Expr, els: Option<@ast::Expr>) -> @ast::Expr; - fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr; + fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::Expr; - fn lambda(&self, span: Span, ids: ~[ast::Ident], blk: ast::Block) -> @ast::expr; - fn lambda0(&self, span: Span, blk: ast::Block) -> @ast::expr; - fn lambda1(&self, span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr; + fn lambda(&self, span: Span, ids: ~[ast::Ident], blk: ast::Block) -> @ast::Expr; + fn lambda0(&self, span: Span, blk: ast::Block) -> @ast::Expr; + fn lambda1(&self, span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::Expr; - fn lambda_expr(&self, span: Span, ids: ~[ast::Ident], blk: @ast::expr) -> @ast::expr; - fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr; - fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr; + fn lambda_expr(&self, span: Span, ids: ~[ast::Ident], blk: @ast::Expr) -> @ast::Expr; + fn lambda_expr_0(&self, span: Span, expr: @ast::Expr) -> @ast::Expr; + fn lambda_expr_1(&self, span: Span, expr: @ast::Expr, ident: ast::Ident) -> @ast::Expr; - fn lambda_stmts(&self, span: Span, ids: ~[ast::Ident], blk: ~[@ast::stmt]) -> @ast::expr; - fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr; - fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::Ident) -> @ast::expr; + fn lambda_stmts(&self, span: Span, ids: ~[ast::Ident], blk: ~[@ast::Stmt]) -> @ast::Expr; + fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::Stmt]) -> @ast::Expr; + fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::Stmt], ident: ast::Ident) -> @ast::Expr; // items fn item(&self, span: Span, @@ -268,7 +268,7 @@ impl AstBuilder for @ExtCtxt { } } - fn ty_mt(&self, ty: ast::Ty, mutbl: ast::mutability) -> ast::mt { + fn ty_mt(&self, ty: ast::Ty, mutbl: ast::Mutability) -> ast::mt { ast::mt { ty: ~ty, mutbl: mutbl @@ -300,16 +300,16 @@ impl AstBuilder for @ExtCtxt { span: Span, ty: ast::Ty, lifetime: Option<ast::Lifetime>, - mutbl: ast::mutability) + mutbl: ast::Mutability) -> ast::Ty { self.ty(span, ast::ty_rptr(lifetime, self.ty_mt(ty, mutbl))) } fn ty_uniq(&self, span: Span, ty: ast::Ty) -> ast::Ty { - self.ty(span, ast::ty_uniq(self.ty_mt(ty, ast::m_imm))) + self.ty(span, ast::ty_uniq(self.ty_mt(ty, ast::MutImmutable))) } fn ty_box(&self, span: Span, - ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty { + ty: ast::Ty, mutbl: ast::Mutability) -> ast::Ty { self.ty(span, ast::ty_box(self.ty_mt(ty, mutbl))) } @@ -329,7 +329,7 @@ impl AstBuilder for @ExtCtxt { fn ty_field_imm(&self, span: Span, name: Ident, ty: ast::Ty) -> ast::TypeField { ast::TypeField { ident: name, - mt: ast::mt { ty: ~ty, mutbl: ast::m_imm }, + mt: ast::mt { ty: ~ty, mutbl: ast::MutImmutable }, span: span, } } @@ -389,11 +389,11 @@ impl AstBuilder for @ExtCtxt { ast::Lifetime { id: self.next_id(), span: span, ident: ident } } - fn stmt_expr(&self, expr: @ast::expr) -> @ast::stmt { - @respan(expr.span, ast::stmt_semi(expr, self.next_id())) + fn stmt_expr(&self, expr: @ast::Expr) -> @ast::Stmt { + @respan(expr.span, ast::StmtSemi(expr, self.next_id())) } - fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: @ast::expr) -> @ast::stmt { + fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: @ast::Expr) -> @ast::Stmt { let pat = self.pat_ident(sp, ident); let local = @ast::Local { is_mutbl: mutbl, @@ -403,8 +403,8 @@ impl AstBuilder for @ExtCtxt { id: self.next_id(), span: sp, }; - let decl = respan(sp, ast::decl_local(local)); - @respan(sp, ast::stmt_decl(@decl, self.next_id())) + let decl = respan(sp, ast::DeclLocal(local)); + @respan(sp, ast::StmtDecl(@decl, self.next_id())) } fn stmt_let_typed(&self, @@ -412,8 +412,8 @@ impl AstBuilder for @ExtCtxt { mutbl: bool, ident: ast::Ident, typ: ast::Ty, - ex: @ast::expr) - -> @ast::stmt { + ex: @ast::Expr) + -> @ast::Stmt { let pat = self.pat_ident(sp, ident); let local = @ast::Local { is_mutbl: mutbl, @@ -423,22 +423,22 @@ impl AstBuilder for @ExtCtxt { id: self.next_id(), span: sp, }; - let decl = respan(sp, ast::decl_local(local)); - @respan(sp, ast::stmt_decl(@decl, self.next_id())) + let decl = respan(sp, ast::DeclLocal(local)); + @respan(sp, ast::StmtDecl(@decl, self.next_id())) } - fn block(&self, span: Span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::Block { + fn block(&self, span: Span, stmts: ~[@ast::Stmt], expr: Option<@Expr>) -> ast::Block { self.block_all(span, ~[], stmts, expr) } - fn block_expr(&self, expr: @ast::expr) -> ast::Block { + fn block_expr(&self, expr: @ast::Expr) -> ast::Block { self.block_all(expr.span, ~[], ~[], Some(expr)) } fn block_all(&self, span: Span, view_items: ~[ast::view_item], - stmts: ~[@ast::stmt], - expr: Option<@ast::expr>) -> ast::Block { + stmts: ~[@ast::Stmt], + expr: Option<@ast::Expr>) -> ast::Block { ast::Block { view_items: view_items, stmts: stmts, @@ -449,122 +449,122 @@ impl AstBuilder for @ExtCtxt { } } - fn expr(&self, span: Span, node: ast::expr_) -> @ast::expr { - @ast::expr { + fn expr(&self, span: Span, node: ast::Expr_) -> @ast::Expr { + @ast::Expr { id: self.next_id(), node: node, span: span, } } - fn expr_path(&self, path: ast::Path) -> @ast::expr { - self.expr(path.span, ast::expr_path(path)) + fn expr_path(&self, path: ast::Path) -> @ast::Expr { + self.expr(path.span, ast::ExprPath(path)) } - fn expr_ident(&self, span: Span, id: ast::Ident) -> @ast::expr { + fn expr_ident(&self, span: Span, id: ast::Ident) -> @ast::Expr { self.expr_path(self.path_ident(span, id)) } - fn expr_self(&self, span: Span) -> @ast::expr { - self.expr(span, ast::expr_self) + fn expr_self(&self, span: Span) -> @ast::Expr { + self.expr(span, ast::ExprSelf) } - fn expr_binary(&self, sp: Span, op: ast::binop, - lhs: @ast::expr, rhs: @ast::expr) -> @ast::expr { - self.expr(sp, ast::expr_binary(self.next_id(), op, lhs, rhs)) + fn expr_binary(&self, sp: Span, op: ast::BinOp, + lhs: @ast::Expr, rhs: @ast::Expr) -> @ast::Expr { + self.expr(sp, ast::ExprBinary(self.next_id(), op, lhs, rhs)) } - fn expr_deref(&self, sp: Span, e: @ast::expr) -> @ast::expr { - self.expr_unary(sp, ast::deref, e) + fn expr_deref(&self, sp: Span, e: @ast::Expr) -> @ast::Expr { + self.expr_unary(sp, ast::UnDeref, e) } - fn expr_unary(&self, sp: Span, op: ast::unop, e: @ast::expr) - -> @ast::expr { - self.expr(sp, ast::expr_unary(self.next_id(), op, e)) + fn expr_unary(&self, sp: Span, op: ast::UnOp, e: @ast::Expr) + -> @ast::Expr { + self.expr(sp, ast::ExprUnary(self.next_id(), op, e)) } - fn expr_managed(&self, sp: Span, e: @ast::expr) -> @ast::expr { - self.expr_unary(sp, ast::box(ast::m_imm), e) + fn expr_managed(&self, sp: Span, e: @ast::Expr) -> @ast::Expr { + self.expr_unary(sp, ast::UnBox(ast::MutImmutable), e) } - fn expr_field_access(&self, sp: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr { - self.expr(sp, ast::expr_field(expr, ident, ~[])) + fn expr_field_access(&self, sp: Span, expr: @ast::Expr, ident: ast::Ident) -> @ast::Expr { + self.expr(sp, ast::ExprField(expr, ident, ~[])) } - fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr { - self.expr(sp, ast::expr_addr_of(ast::m_imm, e)) + fn expr_addr_of(&self, sp: Span, e: @ast::Expr) -> @ast::Expr { + self.expr(sp, ast::ExprAddrOf(ast::MutImmutable, e)) } - fn expr_mut_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr { - self.expr(sp, ast::expr_addr_of(ast::m_mutbl, e)) + fn expr_mut_addr_of(&self, sp: Span, e: @ast::Expr) -> @ast::Expr { + self.expr(sp, ast::ExprAddrOf(ast::MutMutable, e)) } - fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr { - self.expr(span, ast::expr_call(expr, args, ast::NoSugar)) + fn expr_call(&self, span: Span, expr: @ast::Expr, args: ~[@ast::Expr]) -> @ast::Expr { + self.expr(span, ast::ExprCall(expr, args, ast::NoSugar)) } - fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::expr]) -> @ast::expr { + fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::Expr]) -> @ast::Expr { self.expr(span, - ast::expr_call(self.expr_ident(span, id), args, ast::NoSugar)) + ast::ExprCall(self.expr_ident(span, id), args, ast::NoSugar)) } fn expr_call_global(&self, sp: Span, fn_path: ~[ast::Ident], - args: ~[@ast::expr]) -> @ast::expr { + args: ~[@ast::Expr]) -> @ast::Expr { let pathexpr = self.expr_path(self.path_global(sp, fn_path)); self.expr_call(sp, pathexpr, args) } fn expr_method_call(&self, span: Span, - expr: @ast::expr, + expr: @ast::Expr, ident: ast::Ident, - args: ~[@ast::expr]) -> @ast::expr { + args: ~[@ast::Expr]) -> @ast::Expr { self.expr(span, - ast::expr_method_call(self.next_id(), expr, ident, ~[], args, ast::NoSugar)) + ast::ExprMethodCall(self.next_id(), expr, ident, ~[], args, ast::NoSugar)) } - fn expr_block(&self, b: ast::Block) -> @ast::expr { - self.expr(b.span, ast::expr_block(b)) + fn expr_block(&self, b: ast::Block) -> @ast::Expr { + self.expr(b.span, ast::ExprBlock(b)) } - fn field_imm(&self, span: Span, name: Ident, e: @ast::expr) -> ast::Field { + fn field_imm(&self, span: Span, name: Ident, e: @ast::Expr) -> ast::Field { ast::Field { ident: name, expr: e, span: span } } - fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr { - self.expr(span, ast::expr_struct(path, fields, None)) + fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::Expr { + self.expr(span, ast::ExprStruct(path, fields, None)) } fn expr_struct_ident(&self, span: Span, - id: ast::Ident, fields: ~[ast::Field]) -> @ast::expr { + id: ast::Ident, fields: ~[ast::Field]) -> @ast::Expr { self.expr_struct(span, self.path_ident(span, id), fields) } - fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::expr { - self.expr(sp, ast::expr_lit(@respan(sp, lit))) + fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::Expr { + self.expr(sp, ast::ExprLit(@respan(sp, lit))) } - fn expr_uint(&self, span: Span, i: uint) -> @ast::expr { + fn expr_uint(&self, span: Span, i: uint) -> @ast::Expr { self.expr_lit(span, ast::lit_uint(i as u64, ast::ty_u)) } - fn expr_int(&self, sp: Span, i: int) -> @ast::expr { + fn expr_int(&self, sp: Span, i: int) -> @ast::Expr { self.expr_lit(sp, ast::lit_int(i as i64, ast::ty_i)) } - fn expr_u8(&self, sp: Span, u: u8) -> @ast::expr { + fn expr_u8(&self, sp: Span, u: u8) -> @ast::Expr { self.expr_lit(sp, ast::lit_uint(u as u64, ast::ty_u8)) } - fn expr_bool(&self, sp: Span, value: bool) -> @ast::expr { + fn expr_bool(&self, sp: Span, value: bool) -> @ast::Expr { self.expr_lit(sp, ast::lit_bool(value)) } - fn expr_vstore(&self, sp: Span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr { - self.expr(sp, ast::expr_vstore(expr, vst)) + fn expr_vstore(&self, sp: Span, expr: @ast::Expr, vst: ast::ExprVstore) -> @ast::Expr { + self.expr(sp, ast::ExprVstore(expr, vst)) } - fn expr_vec(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr { - self.expr(sp, ast::expr_vec(exprs, ast::m_imm)) + fn expr_vec(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr { + self.expr(sp, ast::ExprVec(exprs, ast::MutImmutable)) } - fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr { - self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::expr_vstore_uniq) + fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr { + self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::ExprVstoreUniq) } - fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr { - self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::expr_vstore_slice) + fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr { + self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::ExprVstoreSlice) } - fn expr_str(&self, sp: Span, s: @str) -> @ast::expr { + fn expr_str(&self, sp: Span, s: @str) -> @ast::Expr { self.expr_lit(sp, ast::lit_str(s)) } - fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::expr { - self.expr_vstore(sp, self.expr_str(sp, s), ast::expr_vstore_uniq) + fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::Expr { + self.expr_vstore(sp, self.expr_str(sp, s), ast::ExprVstoreUniq) } - fn expr_unreachable(&self, span: Span) -> @ast::expr { + fn expr_unreachable(&self, span: Span) -> @ast::Expr { let loc = self.codemap().lookup_char_pos(span.lo); self.expr_call_global( span, @@ -582,110 +582,110 @@ impl AstBuilder for @ExtCtxt { } - fn pat(&self, span: Span, pat: ast::pat_) -> @ast::pat { - @ast::pat { id: self.next_id(), node: pat, span: span } + fn pat(&self, span: Span, pat: ast::Pat_) -> @ast::Pat { + @ast::Pat { id: self.next_id(), node: pat, span: span } } - fn pat_wild(&self, span: Span) -> @ast::pat { - self.pat(span, ast::pat_wild) + fn pat_wild(&self, span: Span) -> @ast::Pat { + self.pat(span, ast::PatWild) } - fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat { - self.pat(span, ast::pat_lit(expr)) + fn pat_lit(&self, span: Span, expr: @ast::Expr) -> @ast::Pat { + self.pat(span, ast::PatLit(expr)) } - fn pat_ident(&self, span: Span, ident: ast::Ident) -> @ast::pat { - self.pat_ident_binding_mode(span, ident, ast::bind_infer) + fn pat_ident(&self, span: Span, ident: ast::Ident) -> @ast::Pat { + self.pat_ident_binding_mode(span, ident, ast::BindInfer) } fn pat_ident_binding_mode(&self, span: Span, ident: ast::Ident, - bm: ast::binding_mode) -> @ast::pat { + bm: ast::BindingMode) -> @ast::Pat { let path = self.path_ident(span, ident); - let pat = ast::pat_ident(bm, path, None); + let pat = ast::PatIdent(bm, path, None); self.pat(span, pat) } - fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat { - let pat = ast::pat_enum(path, Some(subpats)); + fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::Pat]) -> @ast::Pat { + let pat = ast::PatEnum(path, Some(subpats)); self.pat(span, pat) } fn pat_struct(&self, span: Span, - path: ast::Path, field_pats: ~[ast::field_pat]) -> @ast::pat { - let pat = ast::pat_struct(path, field_pats, false); + path: ast::Path, field_pats: ~[ast::FieldPat]) -> @ast::Pat { + let pat = ast::PatStruct(path, field_pats, false); self.pat(span, pat) } - fn arm(&self, _span: Span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm { - ast::arm { + fn arm(&self, _span: Span, pats: ~[@ast::Pat], expr: @ast::Expr) -> ast::Arm { + ast::Arm { pats: pats, guard: None, body: self.block_expr(expr) } } - fn arm_unreachable(&self, span: Span) -> ast::arm { + fn arm_unreachable(&self, span: Span) -> ast::Arm { self.arm(span, ~[self.pat_wild(span)], self.expr_unreachable(span)) } - fn expr_match(&self, span: Span, arg: @ast::expr, arms: ~[ast::arm]) -> @expr { - self.expr(span, ast::expr_match(arg, arms)) + fn expr_match(&self, span: Span, arg: @ast::Expr, arms: ~[ast::Arm]) -> @Expr { + self.expr(span, ast::ExprMatch(arg, arms)) } fn expr_if(&self, span: Span, - cond: @ast::expr, then: @ast::expr, els: Option<@ast::expr>) -> @ast::expr { + cond: @ast::Expr, then: @ast::Expr, els: Option<@ast::Expr>) -> @ast::Expr { let els = els.map_move(|x| self.expr_block(self.block_expr(x))); - self.expr(span, ast::expr_if(cond, self.block_expr(then), els)) + self.expr(span, ast::ExprIf(cond, self.block_expr(then), els)) } - fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr { - self.expr(span, ast::expr_fn_block(fn_decl, blk)) + fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::Expr { + self.expr(span, ast::ExprFnBlock(fn_decl, blk)) } - fn lambda(&self, span: Span, ids: ~[ast::Ident], blk: ast::Block) -> @ast::expr { + fn lambda(&self, span: Span, ids: ~[ast::Ident], blk: ast::Block) -> @ast::Expr { let fn_decl = self.fn_decl( ids.map(|id| self.arg(span, *id, self.ty_infer(span))), self.ty_infer(span)); - self.expr(span, ast::expr_fn_block(fn_decl, blk)) + self.expr(span, ast::ExprFnBlock(fn_decl, blk)) } #[cfg(stage0)] - fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::expr { + fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::Expr { let ext_cx = *self; - let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); + let blk_e = self.expr(blk.span, ast::ExprBlock(blk.clone())); quote_expr!(|| $blk_e ) } #[cfg(not(stage0))] - fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::expr { - let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); + fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::Expr { + let blk_e = self.expr(blk.span, ast::ExprBlock(blk.clone())); quote_expr!(*self, || $blk_e ) } #[cfg(stage0)] - fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr { + fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::Expr { let ext_cx = *self; - let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); + let blk_e = self.expr(blk.span, ast::ExprBlock(blk.clone())); quote_expr!(|$ident| $blk_e ) } #[cfg(not(stage0))] - fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::expr { - let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); + fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::Ident) -> @ast::Expr { + let blk_e = self.expr(blk.span, ast::ExprBlock(blk.clone())); quote_expr!(*self, |$ident| $blk_e ) } - fn lambda_expr(&self, span: Span, ids: ~[ast::Ident], expr: @ast::expr) -> @ast::expr { + fn lambda_expr(&self, span: Span, ids: ~[ast::Ident], expr: @ast::Expr) -> @ast::Expr { self.lambda(span, ids, self.block_expr(expr)) } - fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr { + fn lambda_expr_0(&self, span: Span, expr: @ast::Expr) -> @ast::Expr { self.lambda0(span, self.block_expr(expr)) } - fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::Ident) -> @ast::expr { + fn lambda_expr_1(&self, span: Span, expr: @ast::Expr, ident: ast::Ident) -> @ast::Expr { self.lambda1(span, self.block_expr(expr), ident) } - fn lambda_stmts(&self, span: Span, ids: ~[ast::Ident], stmts: ~[@ast::stmt]) -> @ast::expr { + fn lambda_stmts(&self, span: Span, ids: ~[ast::Ident], stmts: ~[@ast::Stmt]) -> @ast::Expr { self.lambda(span, ids, self.block(span, stmts, None)) } - fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr { + fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::Stmt]) -> @ast::Expr { self.lambda0(span, self.block(span, stmts, None)) } - fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::Ident) -> @ast::expr { + fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::Stmt], ident: ast::Ident) -> @ast::Expr { self.lambda1(span, self.block(span, stmts, None), ident) } @@ -889,8 +889,8 @@ pub trait Duplicate { fn duplicate(&self, cx: @ExtCtxt) -> Self; } -impl Duplicate for @ast::expr { - fn duplicate(&self, cx: @ExtCtxt) -> @ast::expr { +impl Duplicate for @ast::Expr { + fn duplicate(&self, cx: @ExtCtxt) -> @ast::Expr { let folder = fold::default_ast_fold(); let folder = @fold::AstFoldFns { new_id: |_| cx.next_id(), diff --git a/src/libsyntax/ext/bytes.rs b/src/libsyntax/ext/bytes.rs index 1c8f582e7ee..faf3e2653b9 100644 --- a/src/libsyntax/ext/bytes.rs +++ b/src/libsyntax/ext/bytes.rs @@ -24,7 +24,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> bas for expr in exprs.iter() { match expr.node { // expression is a literal - ast::expr_lit(lit) => match lit.node { + ast::ExprLit(lit) => match lit.node { // string literal, push each byte to vector expression ast::lit_str(s) => { for byte in s.byte_iter() { diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 5354a4e2469..16e54093a14 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -34,9 +34,9 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) } let res = str_to_ident(res_str); - let e = @ast::expr { + let e = @ast::Expr { id: cx.next_id(), - node: ast::expr_path( + node: ast::ExprPath( ast::Path { span: sp, global: false, diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs index 01cf61f45a4..9ef995b0d57 100644 --- a/src/libsyntax/ext/deriving/clone.rs +++ b/src/libsyntax/ext/deriving/clone.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{MetaItem, item, expr}; +use ast::{MetaItem, item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -69,7 +69,7 @@ pub fn expand_deriving_deep_clone(cx: @ExtCtxt, fn cs_clone( name: &str, cx: @ExtCtxt, span: Span, - substr: &Substructure) -> @expr { + substr: &Substructure) -> @Expr { let clone_ident = substr.method_ident; let ctor_ident; let all_fields; diff --git a/src/libsyntax/ext/deriving/cmp/eq.rs b/src/libsyntax/ext/deriving/cmp/eq.rs index ce2b9ba7894..d147875d5e1 100644 --- a/src/libsyntax/ext/deriving/cmp/eq.rs +++ b/src/libsyntax/ext/deriving/cmp/eq.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{MetaItem, item, expr}; +use ast::{MetaItem, item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -20,11 +20,11 @@ pub fn expand_deriving_eq(cx: @ExtCtxt, in_items: ~[@item]) -> ~[@item] { // structures are equal if all fields are equal, and non equal, if // any fields are not equal or if the enum variants are different - fn cs_eq(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { + fn cs_eq(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr { cs_and(|cx, span, _, _| cx.expr_bool(span, false), cx, span, substr) } - fn cs_ne(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { + fn cs_ne(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr { cs_or(|cx, span, _, _| cx.expr_bool(span, true), cx, span, substr) } diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index 3f7492bb6b6..33f45d45bdb 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use ast::{MetaItem, item, expr}; +use ast::{MetaItem, item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -48,8 +48,8 @@ pub fn expand_deriving_ord(cx: @ExtCtxt, } /// Strict inequality. -fn cs_op(less: bool, equal: bool, cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { - let op = if less {ast::lt} else {ast::gt}; +fn cs_op(less: bool, equal: bool, cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr { + let op = if less {ast::BiLt} else {ast::BiGt}; cs_fold( false, // need foldr, |cx, span, subexpr, self_f, other_fs| { @@ -79,13 +79,13 @@ fn cs_op(less: bool, equal: bool, cx: @ExtCtxt, span: Span, substr: &Substructur cx.expr_deref(span, self_f), cx.expr_deref(span, other_f)); - let not_cmp = cx.expr_unary(span, ast::not, + let not_cmp = cx.expr_unary(span, ast::UnNot, cx.expr_binary(span, op, cx.expr_deref(span, other_f), cx.expr_deref(span, self_f))); - let and = cx.expr_binary(span, ast::and, not_cmp, subexpr); - cx.expr_binary(span, ast::or, cmp, and) + let and = cx.expr_binary(span, ast::BiAnd, not_cmp, subexpr); + cx.expr_binary(span, ast::BiOr, cmp, and) }, cx.expr_bool(span, equal), |cx, span, args, _| { diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs index 97b7464b3b5..c6123451071 100644 --- a/src/libsyntax/ext/deriving/cmp/totaleq.rs +++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{MetaItem, item, expr}; +use ast::{MetaItem, item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -18,7 +18,7 @@ pub fn expand_deriving_totaleq(cx: @ExtCtxt, span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { - fn cs_equals(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { + fn cs_equals(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr { cs_and(|cx, span, _, _| cx.expr_bool(span, false), cx, span, substr) } diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs index 8f520ff6c33..34c6d1104da 100644 --- a/src/libsyntax/ext/deriving/cmp/totalord.rs +++ b/src/libsyntax/ext/deriving/cmp/totalord.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use ast::{MetaItem, item, expr}; +use ast::{MetaItem, item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -54,7 +54,7 @@ pub fn ordering_const(cx: @ExtCtxt, span: Span, cnst: Ordering) -> ast::Path { } pub fn cs_cmp(cx: @ExtCtxt, span: Span, - substr: &Substructure) -> @expr { + substr: &Substructure) -> @Expr { let test_id = cx.ident_of("__test"); let equals_path = ordering_const(cx, span, Equal); @@ -89,7 +89,7 @@ pub fn cs_cmp(cx: @ExtCtxt, span: Span, let assign = cx.stmt_let(span, false, test_id, new); - let cond = cx.expr_binary(span, ast::eq, + let cond = cx.expr_binary(span, ast::BiEq, cx.expr_ident(span, test_id), cx.expr_path(equals_path.clone())); let if_ = cx.expr_if(span, diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs index 6a2cddb3583..66cd2d511a8 100644 --- a/src/libsyntax/ext/deriving/decodable.rs +++ b/src/libsyntax/ext/deriving/decodable.rs @@ -15,7 +15,7 @@ encodable.rs for more. use std::vec; -use ast::{MetaItem, item, expr, m_mutbl}; +use ast::{MetaItem, item, Expr, MutMutable}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -39,7 +39,7 @@ pub fn expand_deriving_decodable(cx: @ExtCtxt, generics: LifetimeBounds::empty(), explicit_self: None, args: ~[Ptr(~Literal(Path::new_local("__D")), - Borrowed(None, m_mutbl))], + Borrowed(None, MutMutable))], ret_ty: Self, const_nonmatching: true, combine_substructure: decodable_substructure, @@ -51,7 +51,7 @@ pub fn expand_deriving_decodable(cx: @ExtCtxt, } fn decodable_substructure(cx: @ExtCtxt, span: Span, - substr: &Substructure) -> @expr { + substr: &Substructure) -> @Expr { let decoder = substr.nonself_args[0]; let recurse = ~[cx.ident_of("extra"), cx.ident_of("serialize"), diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index ee7863bc270..99b2359232c 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -75,7 +75,7 @@ would yield functions like: } */ -use ast::{MetaItem, item, expr, m_imm, m_mutbl}; +use ast::{MetaItem, item, Expr, MutImmutable, MutMutable}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -97,9 +97,9 @@ pub fn expand_deriving_encodable(cx: @ExtCtxt, MethodDef { name: "encode", generics: LifetimeBounds::empty(), - explicit_self: Some(Some(Borrowed(None, m_imm))), + explicit_self: Some(Some(Borrowed(None, MutImmutable))), args: ~[Ptr(~Literal(Path::new_local("__E")), - Borrowed(None, m_mutbl))], + Borrowed(None, MutMutable))], ret_ty: nil_ty(), const_nonmatching: true, combine_substructure: encodable_substructure, @@ -111,7 +111,7 @@ pub fn expand_deriving_encodable(cx: @ExtCtxt, } fn encodable_substructure(cx: @ExtCtxt, span: Span, - substr: &Substructure) -> @expr { + substr: &Substructure) -> @Expr { let encoder = substr.nonself_args[0]; // throw an underscore in front to suppress unused variable warnings let blkarg = cx.ident_of("_e"); diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index eb05f87a8ce..7050cfbedb7 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -163,7 +163,7 @@ StaticEnum(<ast::enum_def of C>, ~[(<ident of C0>, Left(1)), */ use ast; -use ast::{enum_def, expr, Ident, Generics, struct_def}; +use ast::{enum_def, Expr, Ident, Generics, struct_def}; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -220,9 +220,9 @@ pub struct Substructure<'self> { /// ident of the method method_ident: Ident, /// dereferenced access to any Self or Ptr(Self, _) arguments - self_args: &'self [@expr], + self_args: &'self [@Expr], /// verbatim access to any other arguments - nonself_args: &'self [@expr], + nonself_args: &'self [@Expr], fields: &'self SubstructureFields<'self> } @@ -234,21 +234,21 @@ pub enum SubstructureFields<'self> { ident is the ident of the current field (`None` for all fields in tuple structs). */ - Struct(~[(Option<Ident>, @expr, ~[@expr])]), + Struct(~[(Option<Ident>, @Expr, ~[@Expr])]), /** Matching variants of the enum: variant index, ast::variant, fields: `(field ident, self, [others])`, where the field ident is only non-`None` in the case of a struct variant. */ - EnumMatching(uint, &'self ast::variant, ~[(Option<Ident>, @expr, ~[@expr])]), + EnumMatching(uint, &'self ast::variant, ~[(Option<Ident>, @Expr, ~[@Expr])]), /** non-matching variants of the enum, [(variant index, ast::variant, [field ident, fields])] (i.e. all fields for self are in the first tuple, for other1 are in the second tuple, etc.) */ - EnumNonMatching(&'self [(uint, ast::variant, ~[(Option<Ident>, @expr)])]), + EnumNonMatching(&'self [(uint, ast::variant, ~[(Option<Ident>, @Expr)])]), /// A static method where Self is a struct StaticStruct(&'self ast::struct_def, Either<uint, ~[Ident]>), @@ -263,7 +263,7 @@ Combine the values of all the fields together. The last argument is all the fields of all the structures, see above for details. */ pub type CombineSubstructureFunc<'self> = - &'self fn(@ExtCtxt, Span, &Substructure) -> @expr; + &'self fn(@ExtCtxt, Span, &Substructure) -> @Expr; /** Deal with non-matching enum variants, the arguments are a list @@ -273,8 +273,8 @@ representing each variant: (variant index, ast::variant instance, pub type EnumNonMatchFunc<'self> = &'self fn(@ExtCtxt, Span, &[(uint, ast::variant, - ~[(Option<Ident>, @expr)])], - &[@expr]) -> @expr; + ~[(Option<Ident>, @Expr)])], + &[@Expr]) -> @Expr; impl<'self> TraitDef<'self> { @@ -440,10 +440,10 @@ impl<'self> MethodDef<'self> { cx: @ExtCtxt, span: Span, type_ident: Ident, - self_args: &[@expr], - nonself_args: &[@expr], + self_args: &[@Expr], + nonself_args: &[@Expr], fields: &SubstructureFields) - -> @expr { + -> @Expr { let substructure = Substructure { type_ident: type_ident, method_ident: cx.ident_of(self.name), @@ -466,7 +466,7 @@ impl<'self> MethodDef<'self> { fn split_self_nonself_args(&self, cx: @ExtCtxt, span: Span, type_ident: Ident, generics: &Generics) - -> (ast::explicit_self, ~[@expr], ~[@expr], ~[(Ident, ast::Ty)]) { + -> (ast::explicit_self, ~[@Expr], ~[@Expr], ~[(Ident, ast::Ty)]) { let mut self_args = ~[]; let mut nonself_args = ~[]; @@ -515,7 +515,7 @@ impl<'self> MethodDef<'self> { generics: &Generics, explicit_self: ast::explicit_self, arg_types: ~[(Ident, ast::Ty)], - body: @expr) -> @ast::method { + body: @Expr) -> @ast::method { // create the generics that aren't for Self let fn_generics = self.generics.to_generics(cx, span, type_ident, generics); @@ -572,9 +572,9 @@ impl<'self> MethodDef<'self> { span: Span, struct_def: &struct_def, type_ident: Ident, - self_args: &[@expr], - nonself_args: &[@expr]) - -> @expr { + self_args: &[@Expr], + nonself_args: &[@Expr]) + -> @Expr { let mut raw_fields = ~[]; // ~[[fields of self], // [fields of next Self arg], [etc]] @@ -582,7 +582,7 @@ impl<'self> MethodDef<'self> { for i in range(0u, self_args.len()) { let (pat, ident_expr) = create_struct_pattern(cx, span, type_ident, struct_def, - fmt!("__self_%u", i), ast::m_imm); + fmt!("__self_%u", i), ast::MutImmutable); patterns.push(pat); raw_fields.push(ident_expr); } @@ -626,9 +626,9 @@ impl<'self> MethodDef<'self> { span: Span, struct_def: &struct_def, type_ident: Ident, - self_args: &[@expr], - nonself_args: &[@expr]) - -> @expr { + self_args: &[@Expr], + nonself_args: &[@Expr]) + -> @Expr { let summary = summarise_struct(cx, span, struct_def); self.call_substructure_method(cx, span, @@ -668,9 +668,9 @@ impl<'self> MethodDef<'self> { span: Span, enum_def: &enum_def, type_ident: Ident, - self_args: &[@expr], - nonself_args: &[@expr]) - -> @expr { + self_args: &[@Expr], + nonself_args: &[@Expr]) + -> @Expr { let mut matches = ~[]; self.build_enum_match(cx, span, enum_def, type_ident, self_args, nonself_args, @@ -703,12 +703,12 @@ impl<'self> MethodDef<'self> { cx: @ExtCtxt, span: Span, enum_def: &enum_def, type_ident: Ident, - self_args: &[@expr], - nonself_args: &[@expr], + self_args: &[@Expr], + nonself_args: &[@Expr], matching: Option<uint>, matches_so_far: &mut ~[(uint, ast::variant, - ~[(Option<Ident>, @expr)])], - match_count: uint) -> @expr { + ~[(Option<Ident>, @Expr)])], + match_count: uint) -> @Expr { if match_count == self_args.len() { // we've matched against all arguments, so make the final // expression at the bottom of the match tree @@ -787,7 +787,7 @@ impl<'self> MethodDef<'self> { let (pattern, idents) = create_enum_variant_pattern(cx, span, variant, current_match_str, - ast::m_imm); + ast::MutImmutable); matches_so_far.push((index, /*bad*/ (*variant).clone(), @@ -818,7 +818,7 @@ impl<'self> MethodDef<'self> { let (pattern, idents) = create_enum_variant_pattern(cx, span, variant, current_match_str, - ast::m_imm); + ast::MutImmutable); matches_so_far.push((index, /*bad*/ (*variant).clone(), @@ -853,9 +853,9 @@ impl<'self> MethodDef<'self> { span: Span, enum_def: &enum_def, type_ident: Ident, - self_args: &[@expr], - nonself_args: &[@expr]) - -> @expr { + self_args: &[@Expr], + nonself_args: &[@Expr]) + -> @Expr { let summary = do enum_def.variants.map |v| { let ident = v.node.name; let summary = match v.node.kind { @@ -898,11 +898,11 @@ fn summarise_struct(cx: @ExtCtxt, span: Span, pub fn create_subpatterns(cx: @ExtCtxt, span: Span, field_paths: ~[ast::Path], - mutbl: ast::mutability) - -> ~[@ast::pat] { + mutbl: ast::Mutability) + -> ~[@ast::Pat] { do field_paths.map |path| { cx.pat(span, - ast::pat_ident(ast::bind_by_ref(mutbl), (*path).clone(), None)) + ast::PatIdent(ast::BindByRef(mutbl), (*path).clone(), None)) } } @@ -916,12 +916,12 @@ fn create_struct_pattern(cx: @ExtCtxt, struct_ident: Ident, struct_def: &struct_def, prefix: &str, - mutbl: ast::mutability) - -> (@ast::pat, ~[(Option<Ident>, @expr)]) { + mutbl: ast::Mutability) + -> (@ast::Pat, ~[(Option<Ident>, @Expr)]) { if struct_def.fields.is_empty() { return ( cx.pat_ident_binding_mode( - span, struct_ident, ast::bind_infer), + span, struct_ident, ast::BindInfer), ~[]); } @@ -961,7 +961,7 @@ fn create_struct_pattern(cx: @ExtCtxt, let field_pats = do vec::build |push| { for (&pat, &(id, _)) in subpats.iter().zip(ident_expr.iter()) { // id is guaranteed to be Some - push(ast::field_pat { ident: id.unwrap(), pat: pat }) + push(ast::FieldPat { ident: id.unwrap(), pat: pat }) } }; cx.pat_struct(span, matching_path, field_pats) @@ -976,15 +976,15 @@ fn create_enum_variant_pattern(cx: @ExtCtxt, span: Span, variant: &ast::variant, prefix: &str, - mutbl: ast::mutability) - -> (@ast::pat, ~[(Option<Ident>, @expr)]) { + mutbl: ast::Mutability) + -> (@ast::Pat, ~[(Option<Ident>, @Expr)]) { let variant_ident = variant.node.name; match variant.node.kind { ast::tuple_variant_kind(ref variant_args) => { if variant_args.is_empty() { return (cx.pat_ident_binding_mode( - span, variant_ident, ast::bind_infer), ~[]); + span, variant_ident, ast::BindInfer), ~[]); } let matching_path = cx.path_ident(span, variant_ident); @@ -1023,13 +1023,13 @@ left-to-right (`true`) or right-to-left (`false`). */ pub fn cs_fold(use_foldl: bool, f: &fn(@ExtCtxt, Span, - old: @expr, - self_f: @expr, - other_fs: &[@expr]) -> @expr, - base: @expr, + old: @Expr, + self_f: @Expr, + other_fs: &[@Expr]) -> @Expr, + base: @Expr, enum_nonmatch_f: EnumNonMatchFunc, cx: @ExtCtxt, span: Span, - substructure: &Substructure) -> @expr { + substructure: &Substructure) -> @Expr { match *substructure.fields { EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => { if use_foldl { @@ -1064,10 +1064,10 @@ f(cx, span, ~[self_1.method(__arg_1_1, __arg_2_1), ~~~ */ #[inline] -pub fn cs_same_method(f: &fn(@ExtCtxt, Span, ~[@expr]) -> @expr, +pub fn cs_same_method(f: &fn(@ExtCtxt, Span, ~[@Expr]) -> @Expr, enum_nonmatch_f: EnumNonMatchFunc, cx: @ExtCtxt, span: Span, - substructure: &Substructure) -> @expr { + substructure: &Substructure) -> @Expr { match *substructure.fields { EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => { // call self_n.method(other_1_n, other_2_n, ...) @@ -1097,11 +1097,11 @@ fields. `use_foldl` controls whether this is done left-to-right */ #[inline] pub fn cs_same_method_fold(use_foldl: bool, - f: &fn(@ExtCtxt, Span, @expr, @expr) -> @expr, - base: @expr, + f: &fn(@ExtCtxt, Span, @Expr, @Expr) -> @Expr, + base: @Expr, enum_nonmatch_f: EnumNonMatchFunc, cx: @ExtCtxt, span: Span, - substructure: &Substructure) -> @expr { + substructure: &Substructure) -> @Expr { cs_same_method( |cx, span, vals| { if use_foldl { @@ -1124,10 +1124,10 @@ Use a given binop to combine the result of calling the derived method on all the fields. */ #[inline] -pub fn cs_binop(binop: ast::binop, base: @expr, +pub fn cs_binop(binop: ast::BinOp, base: @Expr, enum_nonmatch_f: EnumNonMatchFunc, cx: @ExtCtxt, span: Span, - substructure: &Substructure) -> @expr { + substructure: &Substructure) -> @Expr { cs_same_method_fold( true, // foldl is good enough |cx, span, old, new| { @@ -1145,8 +1145,8 @@ pub fn cs_binop(binop: ast::binop, base: @expr, #[inline] pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc, cx: @ExtCtxt, span: Span, - substructure: &Substructure) -> @expr { - cs_binop(ast::or, cx.expr_bool(span, false), + substructure: &Substructure) -> @Expr { + cs_binop(ast::BiOr, cx.expr_bool(span, false), enum_nonmatch_f, cx, span, substructure) } @@ -1154,8 +1154,8 @@ pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc, #[inline] pub fn cs_and(enum_nonmatch_f: EnumNonMatchFunc, cx: @ExtCtxt, span: Span, - substructure: &Substructure) -> @expr { - cs_binop(ast::and, cx.expr_bool(span, true), + substructure: &Substructure) -> @Expr { + cs_binop(ast::BiAnd, cx.expr_bool(span, true), enum_nonmatch_f, cx, span, substructure) } diff --git a/src/libsyntax/ext/deriving/iter_bytes.rs b/src/libsyntax/ext/deriving/iter_bytes.rs index 4dd628ca7b0..0f4e57b0889 100644 --- a/src/libsyntax/ext/deriving/iter_bytes.rs +++ b/src/libsyntax/ext/deriving/iter_bytes.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{MetaItem, item, expr, and}; +use ast::{MetaItem, item, Expr, BiAnd}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -42,7 +42,7 @@ pub fn expand_deriving_iter_bytes(cx: @ExtCtxt, trait_def.expand(cx, span, mitem, in_items) } -fn iter_bytes_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { +fn iter_bytes_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr { let (lsb0, f)= match substr.nonself_args { [l, f] => (l, f), _ => cx.span_bug(span, "Incorrect number of arguments in `deriving(IterBytes)`") @@ -90,6 +90,6 @@ fn iter_bytes_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @ } do exprs.slice(1, exprs.len()).iter().fold(exprs[0]) |prev, me| { - cx.expr_binary(span, and, prev, *me) + cx.expr_binary(span, BiAnd, prev, *me) } } diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index b24c8eb84ab..8afd99e80af 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use ast::{MetaItem, item, expr, Ident}; +use ast::{MetaItem, item, Expr, Ident}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::{AstBuilder, Duplicate}; @@ -37,7 +37,7 @@ pub fn expand_deriving_rand(cx: @ExtCtxt, explicit_self: None, args: ~[ Ptr(~Literal(Path::new_local("R")), - Borrowed(None, ast::m_mutbl)) + Borrowed(None, ast::MutMutable)) ], ret_ty: Self, const_nonmatching: false, @@ -48,7 +48,7 @@ pub fn expand_deriving_rand(cx: @ExtCtxt, trait_def.expand(cx, span, mitem, in_items) } -fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { +fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr { let rng = match substr.nonself_args { [rng] => ~[ rng ], _ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`") @@ -100,7 +100,7 @@ fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { // rand() % variants.len() let value_ref = cx.expr_ident(span, value_ident); let rand_variant = cx.expr_binary(span, - ast::rem, + ast::BiRem, value_ref, variant_count); @@ -115,7 +115,7 @@ fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { rand_thing(cx, span, ident, summary, || rand_call())) } } - }.collect::<~[ast::arm]>(); + }.collect::<~[ast::Arm]>(); // _ => {} at the end. Should never occur arms.push(cx.arm_unreachable(span)); @@ -131,7 +131,7 @@ fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { fn rand_thing(cx: @ExtCtxt, span: Span, ctor_ident: Ident, summary: &Either<uint, ~[Ident]>, - rand_call: &fn() -> @expr) -> @expr { + rand_call: &fn() -> @Expr) -> @Expr { match *summary { Left(count) => { if count == 0 { diff --git a/src/libsyntax/ext/deriving/to_str.rs b/src/libsyntax/ext/deriving/to_str.rs index eecce06f69f..fa13f78d0f9 100644 --- a/src/libsyntax/ext/deriving/to_str.rs +++ b/src/libsyntax/ext/deriving/to_str.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use ast::{MetaItem, item, expr}; +use ast::{MetaItem, item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -44,11 +44,11 @@ pub fn expand_deriving_to_str(cx: @ExtCtxt, // to_str() method on each field. Hence we mirror the logic of the log_str() // method, but with tweaks to call to_str() on sub-fields. fn to_str_substructure(cx: @ExtCtxt, span: Span, - substr: &Substructure) -> @expr { + substr: &Substructure) -> @Expr { let to_str = cx.ident_of("to_str"); let doit = |start: &str, end: @str, name: ast::Ident, - fields: &[(Option<ast::Ident>, @expr, ~[@expr])]| { + fields: &[(Option<ast::Ident>, @Expr, ~[@Expr])]| { if fields.len() == 0 { cx.expr_str_uniq(span, cx.str_of(name)) } else { @@ -58,7 +58,7 @@ fn to_str_substructure(cx: @ExtCtxt, span: Span, let mut stmts = ~[cx.stmt_let(span, true, buf, init)]; let push_str = cx.ident_of("push_str"); - let push = |s: @expr| { + let push = |s: @Expr| { let ebuf = cx.expr_ident(span, buf); let call = cx.expr_method_call(span, ebuf, push_str, ~[s]); stmts.push(cx.stmt_expr(call)); diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index 6c1b8100f42..d6f5e2df5a4 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -14,7 +14,7 @@ explicit `Self` type to use when specifying impls to be derived. */ use ast; -use ast::{expr,Generics,Ident}; +use ast::{Expr,Generics,Ident}; use ext::base::ExtCtxt; use ext::build::AstBuilder; use codemap::{Span,respan}; @@ -23,8 +23,8 @@ use opt_vec; /// The types of pointers pub enum PtrTy<'self> { Send, // ~ - Managed(ast::mutability), // @[mut] - Borrowed(Option<&'self str>, ast::mutability), // &['lifetime] [mut] + Managed(ast::Mutability), // @[mut] + Borrowed(Option<&'self str>, ast::Mutability), // &['lifetime] [mut] } /// A path, e.g. `::std::option::Option::<int>` (global). Has support @@ -91,7 +91,7 @@ pub enum Ty<'self> { } pub fn borrowed_ptrty<'r>() -> PtrTy<'r> { - Borrowed(None, ast::m_imm) + Borrowed(None, ast::MutImmutable) } pub fn borrowed<'r>(ty: ~Ty<'r>) -> Ty<'r> { Ptr(ty, borrowed_ptrty()) @@ -236,7 +236,7 @@ impl<'self> LifetimeBounds<'self> { pub fn get_explicit_self(cx: @ExtCtxt, span: Span, self_ptr: &Option<PtrTy>) - -> (@expr, ast::explicit_self) { + -> (@Expr, ast::explicit_self) { let self_path = cx.expr_self(span); match *self_ptr { None => { diff --git a/src/libsyntax/ext/deriving/zero.rs b/src/libsyntax/ext/deriving/zero.rs index f9cd1b4b35b..fc527d44b53 100644 --- a/src/libsyntax/ext/deriving/zero.rs +++ b/src/libsyntax/ext/deriving/zero.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{MetaItem, item, expr}; +use ast::{MetaItem, item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -55,7 +55,7 @@ pub fn expand_deriving_zero(cx: @ExtCtxt, trait_def.expand(cx, span, mitem, in_items) } -fn zero_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { +fn zero_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @Expr { let zero_ident = ~[ cx.ident_of("std"), cx.ident_of("num"), diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 0827a9fabee..adccf513ea9 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{Block, Crate, NodeId, expr_, expr_mac, Ident, mac_invoc_tt}; -use ast::{item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi}; -use ast::{illegal_ctxt}; +use ast::{Block, Crate, NodeId, Expr_, ExprMac, Ident, mac_invoc_tt}; +use ast::{item_mac, Stmt_, StmtMac, StmtExpr, StmtSemi}; +use ast::{ILLEGAL_CTXT}; use ast; use ast_util::{new_rename, new_mark, resolve}; use attr; @@ -31,15 +31,15 @@ use std::vec; pub fn expand_expr(extsbox: @mut SyntaxEnv, cx: @ExtCtxt, - e: &expr_, + e: &Expr_, s: Span, fld: @ast_fold, - orig: @fn(&expr_, Span, @ast_fold) -> (expr_, Span)) - -> (expr_, Span) { + orig: @fn(&Expr_, Span, @ast_fold) -> (Expr_, Span)) + -> (Expr_, Span) { match *e { // expr_mac should really be expr_ext or something; it's the // entry-point for all syntax extensions. - expr_mac(ref mac) => { + ExprMac(ref mac) => { match (*mac).node { // Token-tree macros: mac_invoc_tt(ref pth, ref tts) => { @@ -104,7 +104,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, // Desugar expr_for_loop // From: `for <src_pat> in <src_expr> <src_loop_block>` - ast::expr_for_loop(src_pat, src_expr, ref src_loop_block) => { + ast::ExprForLoop(src_pat, src_expr, ref src_loop_block) => { let src_pat = src_pat.clone(); let src_expr = src_expr.clone(); @@ -118,8 +118,8 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, let hi = s.hi; pub fn mk_expr(cx: @ExtCtxt, span: Span, - node: expr_) -> @ast::expr { - @ast::expr { + node: Expr_) -> @ast::Expr { + @ast::Expr { id: cx.next_id(), node: node, span: span, @@ -127,8 +127,8 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, } fn mk_block(cx: @ExtCtxt, - stmts: &[@ast::stmt], - expr: Option<@ast::expr>, + stmts: &[@ast::Stmt], + expr: Option<@ast::Expr>, span: Span) -> ast::Block { ast::Block { view_items: ~[], @@ -186,33 +186,33 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, let local = @ast::Local { is_mutbl: false, ty: ty, - pat: @ast::pat { + pat: @ast::Pat { id: cx.next_id(), - node: ast::pat_ident(ast::bind_infer, local_path_1, None), + node: ast::PatIdent(ast::BindInfer, local_path_1, None), span: src_expr.span }, init: Some(mk_expr(cx, src_expr.span, - ast::expr_addr_of(ast::m_mutbl, src_expr))), + ast::ExprAddrOf(ast::MutMutable, src_expr))), id: cx.next_id(), span: src_expr.span, }; let e = @spanned(src_expr.span.lo, src_expr.span.hi, - ast::decl_local(local)); - @spanned(lo, hi, ast::stmt_decl(e, cx.next_id())) + ast::DeclLocal(local)); + @spanned(lo, hi, ast::StmtDecl(e, cx.next_id())) }; // `None => break;` let none_arm = { - let break_expr = mk_expr(cx, span, ast::expr_break(None)); - let break_stmt = @spanned(lo, hi, ast::stmt_expr(break_expr, cx.next_id())); + let break_expr = mk_expr(cx, span, ast::ExprBreak(None)); + let break_stmt = @spanned(lo, hi, ast::StmtExpr(break_expr, cx.next_id())); let none_block = mk_block(cx, [break_stmt], None, span); - let none_pat = @ast::pat { + let none_pat = @ast::Pat { id: cx.next_id(), - node: ast::pat_ident(ast::bind_infer, none_path, None), + node: ast::PatIdent(ast::BindInfer, none_path, None), span: span }; - ast::arm { + ast::Arm { pats: ~[none_pat], guard: None, body: none_block @@ -221,12 +221,12 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, // `Some(<src_pat>) => <src_loop_block>` let some_arm = { - let pat = @ast::pat { + let pat = @ast::Pat { id: cx.next_id(), - node: ast::pat_enum(some_path, Some(~[src_pat])), + node: ast::PatEnum(some_path, Some(~[src_pat])), span: src_pat.span }; - ast::arm { + ast::Arm { pats: ~[pat], guard: None, body: src_loop_block @@ -235,27 +235,27 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, // `match i.next() { ... }` let match_stmt = { - let local_expr = mk_expr(cx, span, ast::expr_path(local_path_2)); + let local_expr = mk_expr(cx, span, ast::ExprPath(local_path_2)); let next_call_expr = mk_expr(cx, span, - ast::expr_method_call(cx.next_id(), + ast::ExprMethodCall(cx.next_id(), local_expr, next_ident, ~[], ~[], ast::NoSugar)); - let match_expr = mk_expr(cx, span, ast::expr_match(next_call_expr, + let match_expr = mk_expr(cx, span, ast::ExprMatch(next_call_expr, ~[none_arm, some_arm])); - @spanned(lo, hi, ast::stmt_expr(match_expr, cx.next_id())) + @spanned(lo, hi, ast::StmtExpr(match_expr, cx.next_id())) }; // `loop { ... }` let loop_block = { let loop_body_block = mk_block(cx, [match_stmt], None, span); - let loop_body_expr = mk_expr(cx, span, ast::expr_loop(loop_body_block, None)); - let loop_body_stmt = @spanned(lo, hi, ast::stmt_expr(loop_body_expr, cx.next_id())); + let loop_body_expr = mk_expr(cx, span, ast::ExprLoop(loop_body_block, None)); + let loop_body_stmt = @spanned(lo, hi, ast::StmtExpr(loop_body_expr, cx.next_id())); mk_block(cx, [iter_decl_stmt, loop_body_stmt], None, span) }; - (ast::expr_block(loop_block), span) + (ast::ExprBlock(loop_block), span) } _ => orig(e, s, fld) @@ -448,14 +448,14 @@ fn insert_macro(exts: SyntaxEnv, name: ast::Name, transformer: @Transformer) { // expand a stmt pub fn expand_stmt(extsbox: @mut SyntaxEnv, cx: @ExtCtxt, - s: &stmt_, + s: &Stmt_, sp: Span, fld: @ast_fold, - orig: @fn(&stmt_, Span, @ast_fold) - -> (Option<stmt_>, Span)) - -> (Option<stmt_>, Span) { + orig: @fn(&Stmt_, Span, @ast_fold) + -> (Option<Stmt_>, Span)) + -> (Option<Stmt_>, Span) { let (mac, pth, tts, semi) = match *s { - stmt_mac(ref mac, semi) => { + StmtMac(ref mac, semi) => { match mac.node { mac_invoc_tt(ref pth, ref tts) => { ((*mac).clone(), pth, (*tts).clone(), semi) @@ -484,7 +484,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, }); let expanded = match exp(cx, mac.span, tts) { MRExpr(e) => - @codemap::Spanned { node: stmt_expr(e, cx.next_id()), + @codemap::Spanned { node: StmtExpr(e, cx.next_id()), span: e.span}, MRAny(_,_,stmt_mkr) => stmt_mkr(), _ => cx.span_fatal( @@ -515,7 +515,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, }; (match fully_expanded { - stmt_expr(e, stmt_id) if semi => Some(stmt_semi(e, stmt_id)), + StmtExpr(e, stmt_id) if semi => Some(StmtSemi(e, stmt_id)), _ => { Some(fully_expanded) } /* might already have a semi */ }, sp) @@ -527,12 +527,12 @@ struct NewNameFinderContext { } impl Visitor<()> for NewNameFinderContext { - fn visit_pat(&mut self, pattern: @ast::pat, _: ()) { + fn visit_pat(&mut self, pattern: @ast::Pat, _: ()) { match *pattern { // we found a pat_ident! - ast::pat { + ast::Pat { id: _, - node: ast::pat_ident(_, ref path, ref inner), + node: ast::PatIdent(_, ref path, ref inner), span: _ } => { match path { @@ -589,23 +589,23 @@ impl Visitor<()> for NewNameFinderContext { visit::walk_block(self, block, ()) } - fn visit_stmt(&mut self, stmt: @ast::stmt, _: ()) { + fn visit_stmt(&mut self, stmt: @ast::Stmt, _: ()) { visit::walk_stmt(self, stmt, ()) } - fn visit_arm(&mut self, arm: &ast::arm, _: ()) { + fn visit_arm(&mut self, arm: &ast::Arm, _: ()) { visit::walk_arm(self, arm, ()) } - fn visit_decl(&mut self, decl: @ast::decl, _: ()) { + fn visit_decl(&mut self, decl: @ast::Decl, _: ()) { visit::walk_decl(self, decl, ()) } - fn visit_expr(&mut self, expr: @ast::expr, _: ()) { + fn visit_expr(&mut self, expr: @ast::Expr, _: ()) { visit::walk_expr(self, expr, ()) } - fn visit_expr_post(&mut self, _: @ast::expr, _: ()) { + fn visit_expr_post(&mut self, _: @ast::Expr, _: ()) { // Empty! } @@ -714,7 +714,7 @@ fn renames_to_fold(renames : @mut ~[(ast::Ident,ast::Name)]) -> @ast_fold { } // perform a bunch of renames -fn apply_pending_renames(folder : @ast_fold, stmt : ast::stmt) -> @ast::stmt { +fn apply_pending_renames(folder : @ast_fold, stmt : ast::Stmt) -> @ast::Stmt { match folder.fold_stmt(&stmt) { Some(s) => s, None => fail!(fmt!("renaming of stmt produced None")) @@ -1182,7 +1182,7 @@ pub fn new_ident_resolver() -> |id : ast::Ident| ast::Ident { name : resolve(id), - ctxt : illegal_ctxt + ctxt : ILLEGAL_CTXT } } @@ -1191,7 +1191,7 @@ pub fn new_ident_resolver() -> mod test { use super::*; use ast; - use ast::{Attribute_, AttrOuter, MetaWord, empty_ctxt}; + use ast::{Attribute_, AttrOuter, MetaWord, EMPTY_CTXT}; use codemap; use codemap::Spanned; use parse; @@ -1304,7 +1304,7 @@ mod test { }; let a_name = intern("a"); let a2_name = intern("a2"); - let renamer = new_ident_renamer(ast::Ident{name:a_name,ctxt:empty_ctxt}, + let renamer = new_ident_renamer(ast::Ident{name:a_name,ctxt:EMPTY_CTXT}, a2_name); let renamed_ast = fun_to_ident_folder(renamer).fold_item(item_ast).unwrap(); let resolver = new_ident_resolver(); diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 4e7275b75c8..9adb02ecc98 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -48,8 +48,8 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) // expressions. Also: Cleanup the naming of these functions. // Note: Moved many of the common ones to build.rs --kevina fn pieces_to_expr(cx: @ExtCtxt, sp: Span, - pieces: ~[Piece], args: ~[@ast::expr]) - -> @ast::expr { + pieces: ~[Piece], args: ~[@ast::Expr]) + -> @ast::Expr { fn make_path_vec(ident: &str) -> ~[ast::Ident] { return ~[str_to_ident("std"), str_to_ident("unstable"), @@ -57,15 +57,15 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: Span, str_to_ident("rt"), str_to_ident(ident)]; } - fn make_rt_path_expr(cx: @ExtCtxt, sp: Span, nm: &str) -> @ast::expr { + fn make_rt_path_expr(cx: @ExtCtxt, sp: Span, nm: &str) -> @ast::Expr { let path = make_path_vec(nm); cx.expr_path(cx.path_global(sp, path)) } // Produces an AST expression that represents a RT::conv record, // which tells the RT::conv* functions how to perform the conversion - fn make_rt_conv_expr(cx: @ExtCtxt, sp: Span, cnv: &Conv) -> @ast::expr { - fn make_flags(cx: @ExtCtxt, sp: Span, flags: &[Flag]) -> @ast::expr { + fn make_rt_conv_expr(cx: @ExtCtxt, sp: Span, cnv: &Conv) -> @ast::Expr { + fn make_flags(cx: @ExtCtxt, sp: Span, flags: &[Flag]) -> @ast::Expr { let mut tmp_expr = make_rt_path_expr(cx, sp, "flag_none"); for f in flags.iter() { let fstr = match *f { @@ -75,12 +75,12 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: Span, FlagSignAlways => "flag_sign_always", FlagAlternate => "flag_alternate" }; - tmp_expr = cx.expr_binary(sp, ast::bitor, tmp_expr, + tmp_expr = cx.expr_binary(sp, ast::BiBitOr, tmp_expr, make_rt_path_expr(cx, sp, fstr)); } return tmp_expr; } - fn make_count(cx: @ExtCtxt, sp: Span, cnt: Count) -> @ast::expr { + fn make_count(cx: @ExtCtxt, sp: Span, cnt: Count) -> @ast::Expr { match cnt { CountImplied => { return make_rt_path_expr(cx, sp, "CountImplied"); @@ -94,7 +94,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: Span, _ => cx.span_unimpl(sp, "unimplemented fmt! conversion") } } - fn make_ty(cx: @ExtCtxt, sp: Span, t: Ty) -> @ast::expr { + fn make_ty(cx: @ExtCtxt, sp: Span, t: Ty) -> @ast::Expr { let rt_type = match t { TyHex(c) => match c { CaseUpper => "TyHexUpper", @@ -106,9 +106,9 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: Span, }; return make_rt_path_expr(cx, sp, rt_type); } - fn make_conv_struct(cx: @ExtCtxt, sp: Span, flags_expr: @ast::expr, - width_expr: @ast::expr, precision_expr: @ast::expr, - ty_expr: @ast::expr) -> @ast::expr { + fn make_conv_struct(cx: @ExtCtxt, sp: Span, flags_expr: @ast::Expr, + width_expr: @ast::Expr, precision_expr: @ast::Expr, + ty_expr: @ast::Expr) -> @ast::Expr { cx.expr_struct( sp, cx.path_global(sp, make_path_vec("Conv")), @@ -128,7 +128,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: Span, rt_conv_precision, rt_conv_ty) } fn make_conv_call(cx: @ExtCtxt, sp: Span, conv_type: &str, cnv: &Conv, - arg: @ast::expr, buf: @ast::expr) -> @ast::expr { + arg: @ast::Expr, buf: @ast::Expr) -> @ast::Expr { let fname = ~"conv_" + conv_type; let path = make_path_vec(fname); let cnv_expr = make_rt_conv_expr(cx, sp, cnv); @@ -137,7 +137,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: Span, } fn make_new_conv(cx: @ExtCtxt, sp: Span, cnv: &Conv, - arg: @ast::expr, buf: @ast::expr) -> @ast::expr { + arg: @ast::Expr, buf: @ast::Expr) -> @ast::Expr { fn is_signed_type(cnv: &Conv) -> bool { match cnv.ty { TyInt(s) => match s { diff --git a/src/libsyntax/ext/ifmt.rs b/src/libsyntax/ext/ifmt.rs index 474c0ce60a7..ddddd44c7f1 100644 --- a/src/libsyntax/ext/ifmt.rs +++ b/src/libsyntax/ext/ifmt.rs @@ -34,14 +34,14 @@ struct Context { // Parsed argument expressions and the types that we've found so far for // them. - args: ~[@ast::expr], + args: ~[@ast::Expr], arg_types: ~[Option<ArgumentType>], // Parsed named expressions and the types that we've found for them so far - names: HashMap<@str, @ast::expr>, + names: HashMap<@str, @ast::Expr>, name_types: HashMap<@str, ArgumentType>, // Collection of the compiled `rt::Piece` structures - pieces: ~[@ast::expr], + pieces: ~[@ast::Expr], name_positions: HashMap<@str, uint>, method_statics: ~[@ast::item], @@ -55,8 +55,8 @@ impl Context { /// there's a parse error so we can continue parsing other fmt! expressions. fn parse_args(&mut self, sp: Span, leading_expr: bool, - tts: &[ast::token_tree]) -> (Option<@ast::expr>, - Option<@ast::expr>) { + tts: &[ast::token_tree]) -> (Option<@ast::Expr>, + Option<@ast::Expr>) { let p = rsparse::new_parser_from_tts(self.ecx.parse_sess(), self.ecx.cfg(), tts.to_owned()); @@ -327,7 +327,7 @@ impl Context { } /// Translate a `parse::Piece` to a static `rt::Piece` - fn trans_piece(&mut self, piece: &parse::Piece) -> @ast::expr { + fn trans_piece(&mut self, piece: &parse::Piece) -> @ast::Expr { let sp = self.fmtsp; let parsepath = |s: &str| { ~[self.ecx.ident_of("std"), self.ecx.ident_of("fmt"), @@ -345,7 +345,7 @@ impl Context { let p = self.ecx.path(sp, ~[self.ecx.ident_of("None")]); self.ecx.expr_path(p) }; - let some = |e: @ast::expr| { + let some = |e: @ast::Expr| { self.ecx.expr_call_ident(sp, self.ecx.ident_of("Some"), ~[e]) }; let trans_count = |c: parse::Count| { @@ -444,7 +444,7 @@ impl Context { Some(life), ~[] ), None); - let st = ast::item_static(ty, ast::m_imm, method); + let st = ast::item_static(ty, ast::MutImmutable, method); let static_name = self.ecx.ident_of(fmt!("__static_method_%u", self.method_statics.len())); // Flag these statics as `address_insignificant` so LLVM can @@ -542,16 +542,16 @@ impl Context { /// Actually builds the expression which the ifmt! block will be expanded /// to - fn to_expr(&self, extra: Option<@ast::expr>, f: &str) -> @ast::expr { + fn to_expr(&self, extra: Option<@ast::Expr>, f: &str) -> @ast::Expr { let mut lets = ~[]; let mut locals = ~[]; let mut names = vec::from_fn(self.name_positions.len(), |_| None); // First, declare all of our methods that are statics for &method in self.method_statics.iter() { - let decl = respan(self.fmtsp, ast::decl_item(method)); + let decl = respan(self.fmtsp, ast::DeclItem(method)); lets.push(@respan(self.fmtsp, - ast::stmt_decl(@decl, self.ecx.next_id()))); + ast::StmtDecl(@decl, self.ecx.next_id()))); } // Next, build up the static array which will become our precompiled @@ -570,19 +570,19 @@ impl Context { Some(self.ecx.lifetime(self.fmtsp, self.ecx.ident_of("static"))), ~[] ), None), - ast::m_imm + ast::MutImmutable ), self.ecx.expr_uint(self.fmtsp, self.pieces.len()) ); let ty = self.ecx.ty(self.fmtsp, ty); - let st = ast::item_static(ty, ast::m_imm, fmt); + let st = ast::item_static(ty, ast::MutImmutable, fmt); let static_name = self.ecx.ident_of("__static_fmtstr"); // see above comment for `address_insignificant` and why we do it let unnamed = self.ecx.meta_word(self.fmtsp, @"address_insignificant"); let unnamed = self.ecx.attribute(self.fmtsp, unnamed); let item = self.ecx.item(self.fmtsp, static_name, ~[unnamed], st); - let decl = respan(self.fmtsp, ast::decl_item(item)); - lets.push(@respan(self.fmtsp, ast::stmt_decl(@decl, self.ecx.next_id()))); + let decl = respan(self.fmtsp, ast::DeclItem(item)); + lets.push(@respan(self.fmtsp, ast::StmtDecl(@decl, self.ecx.next_id()))); // Right now there is a bug such that for the expression: // foo(bar(&1)) @@ -637,7 +637,7 @@ impl Context { } fn format_arg(&self, sp: Span, arg: Either<uint, @str>, - ident: ast::Ident) -> @ast::expr { + ident: ast::Ident) -> @ast::Expr { let ty = match arg { Left(i) => self.arg_types[i].unwrap(), Right(s) => *self.name_types.get(&s) diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs index 206cc7be1fd..adc246ab89a 100644 --- a/src/libsyntax/ext/log_syntax.rs +++ b/src/libsyntax/ext/log_syntax.rs @@ -29,9 +29,9 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, get_ident_interner())); //trivial expression - MRExpr(@ast::expr { + MRExpr(@ast::Expr { id: cx.next_id(), - node: ast::expr_lit(@codemap::Spanned { + node: ast::ExprLit(@codemap::Spanned { node: ast::lit_nil, span: sp }), diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index bea18d868a0..8d43872e9c1 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -104,7 +104,7 @@ pub mod rt { } } - impl ToSource for @ast::expr { + impl ToSource for @ast::Expr { fn to_source(&self) -> @str { pprust::expr_to_str(*self, get_ident_interner()).to_managed() } @@ -222,7 +222,7 @@ pub mod rt { impl_to_tokens!(ast::Ty) impl_to_tokens_self!(&'self [ast::Ty]) impl_to_tokens!(Generics) - impl_to_tokens!(@ast::expr) + impl_to_tokens!(@ast::Expr) impl_to_tokens!(ast::Block) impl_to_tokens_self!(&'self str) impl_to_tokens!(int) @@ -238,8 +238,8 @@ pub mod rt { pub trait ExtParseUtils { fn parse_item(&self, s: @str) -> @ast::item; - fn parse_expr(&self, s: @str) -> @ast::expr; - fn parse_stmt(&self, s: @str) -> @ast::stmt; + fn parse_expr(&self, s: @str) -> @ast::Expr; + fn parse_stmt(&self, s: @str) -> @ast::Stmt; fn parse_tts(&self, s: @str) -> ~[ast::token_tree]; } @@ -261,7 +261,7 @@ pub mod rt { } } - fn parse_stmt(&self, s: @str) -> @ast::stmt { + fn parse_stmt(&self, s: @str) -> @ast::Stmt { parse::parse_stmt_from_source_str( @"<quote expansion>", s, @@ -270,7 +270,7 @@ pub mod rt { self.parse_sess()) } - fn parse_expr(&self, s: @str) -> @ast::expr { + fn parse_expr(&self, s: @str) -> @ast::Expr { parse::parse_expr_from_source_str( @"<quote expansion>", s, @@ -343,7 +343,7 @@ fn id_ext(str: &str) -> ast::Ident { } // Lift an ident to the expr that evaluates to that ident. -fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::expr { +fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::Expr { let e_str = cx.expr_str(sp, cx.str_of(ident)); cx.expr_method_call(sp, cx.expr_ident(sp, id_ext("ext_cx")), @@ -351,13 +351,13 @@ fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::Ident) -> @ast::expr { ~[e_str]) } -fn mk_bytepos(cx: @ExtCtxt, sp: Span, bpos: BytePos) -> @ast::expr { +fn mk_bytepos(cx: @ExtCtxt, sp: Span, bpos: BytePos) -> @ast::Expr { let path = id_ext("BytePos"); let arg = cx.expr_uint(sp, bpos.to_uint()); cx.expr_call_ident(sp, path, ~[arg]) } -fn mk_binop(cx: @ExtCtxt, sp: Span, bop: token::binop) -> @ast::expr { +fn mk_binop(cx: @ExtCtxt, sp: Span, bop: token::binop) -> @ast::Expr { let name = match bop { PLUS => "PLUS", MINUS => "MINUS", @@ -373,7 +373,7 @@ fn mk_binop(cx: @ExtCtxt, sp: Span, bop: token::binop) -> @ast::expr { cx.expr_ident(sp, id_ext(name)) } -fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::expr { +fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { match *tok { BINOP(binop) => { @@ -515,7 +515,7 @@ fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::expr { fn mk_tt(cx: @ExtCtxt, sp: Span, tt: &ast::token_tree) - -> ~[@ast::stmt] { + -> ~[@ast::Stmt] { match *tt { @@ -557,7 +557,7 @@ fn mk_tt(cx: @ExtCtxt, sp: Span, tt: &ast::token_tree) } fn mk_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) - -> ~[@ast::stmt] { + -> ~[@ast::Stmt] { let mut ss = ~[]; for tt in tts.iter() { ss.push_all_move(mk_tt(cx, sp, tt)); @@ -567,7 +567,7 @@ fn mk_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) fn expand_tts(cx: @ExtCtxt, sp: Span, - tts: &[ast::token_tree]) -> (@ast::expr, @ast::expr) { + tts: &[ast::token_tree]) -> (@ast::Expr, @ast::Expr) { // NB: It appears that the main parser loses its mind if we consider // $foo as a tt_nonterminal during the main parse, so we have to re-parse @@ -640,8 +640,8 @@ fn expand_tts(cx: @ExtCtxt, fn expand_wrapper(cx: @ExtCtxt, sp: Span, - cx_expr: @ast::expr, - expr: @ast::expr) -> @ast::expr { + cx_expr: @ast::Expr, + expr: @ast::Expr) -> @ast::Expr { let uses = ~[ cx.view_use_glob(sp, ast::public, ids_ext(~[~"syntax", ~"ext", @@ -656,8 +656,8 @@ fn expand_wrapper(cx: @ExtCtxt, fn expand_parse_call(cx: @ExtCtxt, sp: Span, parse_method: &str, - arg_exprs: ~[@ast::expr], - tts: &[ast::token_tree]) -> @ast::expr { + arg_exprs: ~[@ast::Expr], + tts: &[ast::token_tree]) -> @ast::Expr { let (cx_expr, tts_expr) = expand_tts(cx, sp, tts); let cfg_call = || cx.expr_method_call( diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 96c8482c418..e76ade0dc3d 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -105,7 +105,7 @@ pub fn expand_include_bin(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) let file = get_single_str_from_tts(cx, sp, tts, "include_bin!"); match io::read_whole_file(&res_rel_file(cx, sp, &Path(file))) { result::Ok(src) => { - let u8_exprs: ~[@ast::expr] = src.iter().map(|char| cx.expr_u8(sp, *char)).collect(); + let u8_exprs: ~[@ast::Expr] = src.iter().map(|char| cx.expr_u8(sp, *char)).collect(); base::MRExpr(cx.expr_vec(sp, u8_exprs)) } result::Err(ref e) => { |
