Replace 'blk' -> 'block' in AstBuilder.
I didn't rename variables because they are local and are not parts of the public interfaces. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
This commit is contained in:
parent
eb5743bfb2
commit
09efc4e855
@ -76,12 +76,12 @@ pub trait AstBuilder {
|
|||||||
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;
|
||||||
|
|
||||||
// blocks
|
// blocks
|
||||||
fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block;
|
fn block(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block;
|
||||||
fn blk_expr(&self, expr: @ast::expr) -> ast::Block;
|
fn block_expr(&self, expr: @ast::expr) -> ast::Block;
|
||||||
fn blk_all(&self, span: span,
|
fn block_all(&self, span: span,
|
||||||
view_items: ~[ast::view_item],
|
view_items: ~[ast::view_item],
|
||||||
stmts: ~[@ast::stmt],
|
stmts: ~[@ast::stmt],
|
||||||
expr: Option<@ast::expr>) -> ast::Block;
|
expr: Option<@ast::expr>) -> ast::Block;
|
||||||
|
|
||||||
// expressions
|
// expressions
|
||||||
fn expr(&self, span: span, node: ast::expr_) -> @ast::expr;
|
fn expr(&self, span: span, node: ast::expr_) -> @ast::expr;
|
||||||
@ -105,7 +105,7 @@ pub trait AstBuilder {
|
|||||||
fn expr_method_call(&self, span: span,
|
fn expr_method_call(&self, span: span,
|
||||||
expr: @ast::expr, ident: ast::ident,
|
expr: @ast::expr, ident: ast::ident,
|
||||||
args: ~[@ast::expr]) -> @ast::expr;
|
args: ~[@ast::expr]) -> @ast::expr;
|
||||||
fn expr_blk(&self, b: ast::Block) -> @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 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(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr;
|
||||||
@ -387,18 +387,18 @@ impl AstBuilder for @ExtCtxt {
|
|||||||
@respan(sp, ast::stmt_decl(@decl, self.next_id()))
|
@respan(sp, ast::stmt_decl(@decl, self.next_id()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blk(&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.blk_all(span, ~[], stmts, expr)
|
self.block_all(span, ~[], stmts, expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blk_expr(&self, expr: @ast::expr) -> ast::Block {
|
fn block_expr(&self, expr: @ast::expr) -> ast::Block {
|
||||||
self.blk_all(expr.span, ~[], ~[], Some(expr))
|
self.block_all(expr.span, ~[], ~[], Some(expr))
|
||||||
}
|
}
|
||||||
fn blk_all(&self,
|
fn block_all(&self,
|
||||||
span: span,
|
span: span,
|
||||||
view_items: ~[ast::view_item],
|
view_items: ~[ast::view_item],
|
||||||
stmts: ~[@ast::stmt],
|
stmts: ~[@ast::stmt],
|
||||||
expr: Option<@ast::expr>) -> ast::Block {
|
expr: Option<@ast::expr>) -> ast::Block {
|
||||||
ast::Block {
|
ast::Block {
|
||||||
view_items: view_items,
|
view_items: view_items,
|
||||||
stmts: stmts,
|
stmts: stmts,
|
||||||
@ -474,7 +474,7 @@ impl AstBuilder for @ExtCtxt {
|
|||||||
self.expr(span,
|
self.expr(span,
|
||||||
ast::expr_method_call(self.next_id(), expr, ident, ~[], args, ast::NoSugar))
|
ast::expr_method_call(self.next_id(), expr, ident, ~[], args, ast::NoSugar))
|
||||||
}
|
}
|
||||||
fn expr_blk(&self, b: ast::Block) -> @ast::expr {
|
fn expr_block(&self, b: ast::Block) -> @ast::expr {
|
||||||
self.expr(b.span, ast::expr_block(b))
|
self.expr(b.span, ast::expr_block(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 {
|
||||||
@ -577,7 +577,7 @@ impl AstBuilder for @ExtCtxt {
|
|||||||
ast::arm {
|
ast::arm {
|
||||||
pats: pats,
|
pats: pats,
|
||||||
guard: None,
|
guard: None,
|
||||||
body: self.blk_expr(expr)
|
body: self.block_expr(expr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,8 +591,8 @@ impl AstBuilder for @ExtCtxt {
|
|||||||
|
|
||||||
fn expr_if(&self, span: span,
|
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(|x| self.expr_blk(self.blk_expr(*x)));
|
let els = els.map(|x| self.expr_block(self.block_expr(*x)));
|
||||||
self.expr(span, ast::expr_if(cond, self.blk_expr(then), els))
|
self.expr(span, ast::expr_if(cond, self.block_expr(then), els))
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
@ -618,23 +618,23 @@ impl AstBuilder for @ExtCtxt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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.blk_expr(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.blk_expr(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.blk_expr(expr), ident)
|
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.blk(span, stmts, None))
|
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.blk(span, stmts, None))
|
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.blk(span, stmts, None), ident)
|
self.lambda1(span, self.block(span, stmts, None), ident)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn arg(&self, span: span, ident: ast::ident, ty: ast::Ty) -> ast::arg {
|
fn arg(&self, span: span, ident: ast::ident, ty: ast::Ty) -> ast::arg {
|
||||||
|
@ -178,7 +178,7 @@ fn encodable_substructure(cx: @ExtCtxt, span: span,
|
|||||||
~[cx.expr_str(span,
|
~[cx.expr_str(span,
|
||||||
cx.str_of(substr.type_ident)),
|
cx.str_of(substr.type_ident)),
|
||||||
blk]);
|
blk]);
|
||||||
cx.expr_blk(cx.blk(span, ~[me], Some(ret)))
|
cx.expr_block(cx.block(span, ~[me], Some(ret)))
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => cx.bug("expected Struct or EnumMatching in deriving(Encodable)")
|
_ => cx.bug("expected Struct or EnumMatching in deriving(Encodable)")
|
||||||
|
@ -528,7 +528,7 @@ impl<'self> MethodDef<'self> {
|
|||||||
|
|
||||||
let method_ident = cx.ident_of(self.name);
|
let method_ident = cx.ident_of(self.name);
|
||||||
let fn_decl = cx.fn_decl(args, ret_type);
|
let fn_decl = cx.fn_decl(args, ret_type);
|
||||||
let body_block = cx.blk_expr(body);
|
let body_block = cx.block_expr(body);
|
||||||
|
|
||||||
|
|
||||||
// Create the method.
|
// Create the method.
|
||||||
|
@ -79,7 +79,7 @@ fn to_str_substructure(cx: @ExtCtxt, span: span,
|
|||||||
}
|
}
|
||||||
push(cx.expr_str(span, end));
|
push(cx.expr_str(span, end));
|
||||||
|
|
||||||
cx.expr_blk(cx.blk(span, stmts, Some(cx.expr_ident(span, buf))))
|
cx.expr_block(cx.block(span, stmts, Some(cx.expr_ident(span, buf))))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -323,5 +323,5 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
|
|||||||
nargs, expected_nargs));
|
nargs, expected_nargs));
|
||||||
}
|
}
|
||||||
|
|
||||||
cx.expr_blk(cx.blk(fmt_sp, stms, Some(buf())))
|
cx.expr_block(cx.block(fmt_sp, stms, Some(buf())))
|
||||||
}
|
}
|
||||||
|
@ -705,11 +705,11 @@ fn expand_tts(cx: @ExtCtxt,
|
|||||||
id_ext("tt"),
|
id_ext("tt"),
|
||||||
cx.expr_vec_uniq(sp, ~[]));
|
cx.expr_vec_uniq(sp, ~[]));
|
||||||
|
|
||||||
cx.expr_blk(
|
cx.expr_block(
|
||||||
cx.blk_all(sp, uses,
|
cx.block_all(sp, uses,
|
||||||
~[stmt_let_sp,
|
~[stmt_let_sp,
|
||||||
stmt_let_tt] + mk_tts(cx, sp, tts),
|
stmt_let_tt] + mk_tts(cx, sp, tts),
|
||||||
Some(cx.expr_ident(sp, id_ext("tt")))))
|
Some(cx.expr_ident(sp, id_ext("tt")))))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expand_parse_call(cx: @ExtCtxt,
|
fn expand_parse_call(cx: @ExtCtxt,
|
||||||
|
Loading…
Reference in New Issue
Block a user