Rename the block type to be blk also. Sorry.
This commit is contained in:
parent
552bff8a21
commit
25a89e068d
21 changed files with 83 additions and 82 deletions
|
@ -78,8 +78,8 @@ fn filter_stmt(&ast::crate_cfg cfg,
|
|||
}
|
||||
}
|
||||
|
||||
fn fold_block(&ast::crate_cfg cfg, &ast::block_ b,
|
||||
fold::ast_fold fld) -> ast::block_ {
|
||||
fn fold_block(&ast::crate_cfg cfg, &ast::blk_ b,
|
||||
fold::ast_fold fld) -> ast::blk_ {
|
||||
auto filter = bind filter_stmt(cfg, _);
|
||||
auto filtered_stmts = ivec::filter_map(filter, b.stmts);
|
||||
ret rec(stmts=ivec::map(fld.fold_stmt, filtered_stmts),
|
||||
|
|
|
@ -186,7 +186,7 @@ fn mk_tests(&test_ctxt cx) -> @ast::item {
|
|||
// The vector of test_descs for this crate
|
||||
auto test_descs = mk_test_desc_vec(cx);
|
||||
|
||||
let ast::block_ body_= rec(stmts = ~[],
|
||||
let ast::blk_ body_= rec(stmts = ~[],
|
||||
expr = option::some(test_descs),
|
||||
id = cx.next_node_id());
|
||||
auto body = nospan(body_);
|
||||
|
@ -313,7 +313,7 @@ fn mk_main(&test_ctxt cx) -> @ast::item {
|
|||
|
||||
auto test_main_call_expr = mk_test_main_call(cx);
|
||||
|
||||
let ast::block_ body_ = rec(stmts = ~[],
|
||||
let ast::blk_ body_ = rec(stmts = ~[],
|
||||
expr = option::some(test_main_call_expr),
|
||||
id = cx.next_node_id());
|
||||
auto body = rec(node = body_, span = rec(lo=0u, hi=0u));
|
||||
|
|
|
@ -326,7 +326,7 @@ fn arm_defnums(&ast::arm arm) -> node_id[] {
|
|||
}
|
||||
|
||||
fn check_for_each(&ctx cx, &@ast::local local, &@ast::expr call,
|
||||
&ast::block blk, &scope sc, &vt[scope] v) {
|
||||
&ast::blk blk, &scope sc, &vt[scope] v) {
|
||||
visit::visit_expr(call, sc, v);
|
||||
alt (call.node) {
|
||||
case (ast::expr_call(?f, ?args)) {
|
||||
|
@ -344,7 +344,7 @@ fn check_for_each(&ctx cx, &@ast::local local, &@ast::expr call,
|
|||
}
|
||||
}
|
||||
|
||||
fn check_for(&ctx cx, &@ast::local local, &@ast::expr seq, &ast::block blk,
|
||||
fn check_for(&ctx cx, &@ast::local local, &@ast::expr seq, &ast::blk blk,
|
||||
&scope sc, &vt[scope] v) {
|
||||
visit::visit_expr(seq, sc, v);
|
||||
auto defnum = local.node.id;
|
||||
|
|
|
@ -52,7 +52,7 @@ tag scope {
|
|||
scope_fn(ast::fn_decl, ast::ty_param[]);
|
||||
scope_native_item(@ast::native_item);
|
||||
scope_loop(@ast::local); // there's only 1 decl per loop.
|
||||
scope_block(ast::block);
|
||||
scope_block(ast::blk);
|
||||
scope_arm(ast::arm);
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ fn visit_fn_with_scope(&@env e, &ast::_fn f, &ast::ty_param[] tp, &span sp,
|
|||
cons(scope_fn(f.decl, tp), @sc), v);
|
||||
}
|
||||
|
||||
fn visit_block_with_scope(&ast::block b, &scopes sc, &vt[scopes] v) {
|
||||
fn visit_block_with_scope(&ast::blk b, &scopes sc, &vt[scopes] v) {
|
||||
visit::visit_block(b, cons(scope_block(b), @sc), v);
|
||||
}
|
||||
|
||||
|
@ -781,7 +781,7 @@ fn lookup_in_obj(&ident name, &ast::_obj ob, &ast::ty_param[] ty_params,
|
|||
}
|
||||
}
|
||||
|
||||
fn lookup_in_block(&ident name, &ast::block_ b, namespace ns) ->
|
||||
fn lookup_in_block(&ident name, &ast::blk_ b, namespace ns) ->
|
||||
option::t[def] {
|
||||
for (@ast::stmt st in b.stmts) {
|
||||
alt (st.node) {
|
||||
|
@ -1319,7 +1319,7 @@ fn check_arm(@env e, &ast::arm a, &() x, &vt[()] v) {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_block(@env e, &ast::block b, &() x, &vt[()] v) {
|
||||
fn check_block(@env e, &ast::blk b, &() x, &vt[()] v) {
|
||||
visit::visit_block(b, x, v);
|
||||
auto values = checker(*e, "value");
|
||||
auto types = checker(*e, "type");
|
||||
|
|
|
@ -3696,7 +3696,7 @@ fn join_branches(&@block_ctxt parent_cx, &result[] ins) -> @block_ctxt {
|
|||
|
||||
tag out_method { return; save_in(ValueRef); }
|
||||
|
||||
fn trans_if(&@block_ctxt cx, &@ast::expr cond, &ast::block thn,
|
||||
fn trans_if(&@block_ctxt cx, &@ast::expr cond, &ast::blk thn,
|
||||
&option::t[@ast::expr] els, ast::node_id id, &out_method output)
|
||||
-> result {
|
||||
auto cond_res = trans_expr(cx, cond);
|
||||
|
@ -3731,11 +3731,11 @@ fn trans_if(&@block_ctxt cx, &@ast::expr cond, &ast::block thn,
|
|||
}
|
||||
|
||||
fn trans_for(&@block_ctxt cx, &@ast::local local, &@ast::expr seq,
|
||||
&ast::block body) -> result {
|
||||
&ast::blk body) -> result {
|
||||
// FIXME: We bind to an alias here to avoid a segfault... this is
|
||||
// obviously a bug.
|
||||
fn inner(&@block_ctxt cx, @ast::local local, ValueRef curr, ty::t t,
|
||||
&ast::block body, @block_ctxt outer_next_cx) -> result {
|
||||
&ast::blk body, @block_ctxt outer_next_cx) -> result {
|
||||
auto next_cx = new_sub_block_ctxt(cx, "next");
|
||||
auto scope_cx =
|
||||
new_loop_scope_block_ctxt(cx, option::some[@block_ctxt](next_cx),
|
||||
|
@ -3906,7 +3906,7 @@ fn load_environment(&@block_ctxt cx, &@fn_ctxt fcx,
|
|||
}
|
||||
|
||||
fn trans_for_each(&@block_ctxt cx, &@ast::local local, &@ast::expr seq,
|
||||
&ast::block body) -> result {
|
||||
&ast::blk body) -> result {
|
||||
/*
|
||||
* The translation is a little .. complex here. Code like:
|
||||
*
|
||||
|
@ -3985,7 +3985,7 @@ fn trans_for_each(&@block_ctxt cx, &@ast::local local, &@ast::expr seq,
|
|||
}
|
||||
}
|
||||
|
||||
fn trans_while(&@block_ctxt cx, &@ast::expr cond, &ast::block body) ->
|
||||
fn trans_while(&@block_ctxt cx, &@ast::expr cond, &ast::blk body) ->
|
||||
result {
|
||||
auto cond_cx = new_scope_block_ctxt(cx, "while cond");
|
||||
auto next_cx = new_sub_block_ctxt(cx, "next");
|
||||
|
@ -4001,7 +4001,7 @@ fn trans_while(&@block_ctxt cx, &@ast::expr cond, &ast::block body) ->
|
|||
ret rslt(next_cx, C_nil());
|
||||
}
|
||||
|
||||
fn trans_do_while(&@block_ctxt cx, &ast::block body, &@ast::expr cond) ->
|
||||
fn trans_do_while(&@block_ctxt cx, &ast::blk body, &@ast::expr cond) ->
|
||||
result {
|
||||
auto next_cx = new_sub_block_ctxt(cx, "next");
|
||||
auto body_cx =
|
||||
|
@ -6256,7 +6256,7 @@ fn trans_block_cleanups(&@block_ctxt cx, &@block_ctxt cleanup_cx)
|
|||
ret bcx;
|
||||
}
|
||||
|
||||
iter block_locals(&ast::block b) -> @ast::local {
|
||||
iter block_locals(&ast::blk b) -> @ast::local {
|
||||
// FIXME: putting from inside an iter block doesn't work, so we can't
|
||||
// use the index here.
|
||||
for (@ast::stmt s in b.node.stmts) {
|
||||
|
@ -6343,7 +6343,7 @@ fn alloc_local(&@block_ctxt cx, &@ast::local local) -> result {
|
|||
ret r;
|
||||
}
|
||||
|
||||
fn trans_block(&@block_ctxt cx, &ast::block b, &out_method output) -> result {
|
||||
fn trans_block(&@block_ctxt cx, &ast::blk b, &out_method output) -> result {
|
||||
auto bcx = cx;
|
||||
for each (@ast::local local in block_locals(b)) {
|
||||
// FIXME Update bcx.sp
|
||||
|
|
|
@ -446,7 +446,7 @@ fn trans_recv(&@block_ctxt bcx, &dest dest, &@ast::expr expr) -> @block_ctxt {
|
|||
ret bcx; // TODO
|
||||
}
|
||||
|
||||
fn trans_block(&@block_ctxt cx, &dest dest, &ast::block blk)
|
||||
fn trans_block(&@block_ctxt cx, &dest dest, &ast::blk blk)
|
||||
-> @block_ctxt {
|
||||
auto bcx = cx;
|
||||
for each (@ast::local local in trans::block_locals(blk)) {
|
||||
|
|
|
@ -27,7 +27,7 @@ fn collect_ids_expr(&@expr e, @mutable node_id[] rs) {
|
|||
*rs += ~[e.id];
|
||||
}
|
||||
|
||||
fn collect_ids_block(&block b, @mutable node_id[] rs) {
|
||||
fn collect_ids_block(&blk b, @mutable node_id[] rs) {
|
||||
*rs += ~[b.node.id];
|
||||
}
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ fn stmt_pp(&crate_ctxt ccx, &stmt s) -> pre_and_post {
|
|||
|
||||
|
||||
/* fails if b has no annotation */
|
||||
fn block_pp(&crate_ctxt ccx, &block b) -> pre_and_post {
|
||||
fn block_pp(&crate_ctxt ccx, &blk b) -> pre_and_post {
|
||||
log "block_pp";
|
||||
ret node_id_to_ts_ann(ccx, b.node.id).conditions;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ fn clear_precond(&crate_ctxt ccx, node_id id) {
|
|||
ann::clear(pp.conditions.precondition);
|
||||
}
|
||||
|
||||
fn block_states(&crate_ctxt ccx, &block b) -> pre_and_post_state {
|
||||
fn block_states(&crate_ctxt ccx, &blk b) -> pre_and_post_state {
|
||||
log "block_states";
|
||||
ret node_id_to_ts_ann(ccx, b.node.id).states;
|
||||
}
|
||||
|
@ -392,19 +392,19 @@ fn stmt_poststate(&crate_ctxt ccx, &stmt s) -> poststate {
|
|||
ret stmt_states(ccx, s).poststate;
|
||||
}
|
||||
|
||||
fn block_precond(&crate_ctxt ccx, &block b) -> precond {
|
||||
fn block_precond(&crate_ctxt ccx, &blk b) -> precond {
|
||||
ret block_pp(ccx, b).precondition;
|
||||
}
|
||||
|
||||
fn block_postcond(&crate_ctxt ccx, &block b) -> postcond {
|
||||
fn block_postcond(&crate_ctxt ccx, &blk b) -> postcond {
|
||||
ret block_pp(ccx, b).postcondition;
|
||||
}
|
||||
|
||||
fn block_prestate(&crate_ctxt ccx, &block b) -> prestate {
|
||||
fn block_prestate(&crate_ctxt ccx, &blk b) -> prestate {
|
||||
ret block_states(ccx, b).prestate;
|
||||
}
|
||||
|
||||
fn block_poststate(&crate_ctxt ccx, &block b) -> poststate {
|
||||
fn block_poststate(&crate_ctxt ccx, &blk b) -> poststate {
|
||||
ret block_states(ccx, b).poststate;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ fn declare_var(&fn_ctxt fcx, &tsconstr c, prestate pre) -> prestate {
|
|||
ret rslt;
|
||||
}
|
||||
|
||||
fn relax_precond_block_non_recursive(&fn_ctxt fcx, node_id i, &block b) {
|
||||
fn relax_precond_block_non_recursive(&fn_ctxt fcx, node_id i, &blk b) {
|
||||
relax_precond(i as uint, block_precond(fcx.ccx, b));
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ fn relax_precond_stmt(&fn_ctxt fcx, node_id i, &@stmt s) {
|
|||
relax_precond(i as uint, stmt_precond(fcx.ccx, *s));
|
||||
}
|
||||
|
||||
fn relax_precond_block(&fn_ctxt fcx, node_id i, &block b) {
|
||||
fn relax_precond_block(&fn_ctxt fcx, node_id i, &blk b) {
|
||||
relax_precond_block_non_recursive(fcx, i, b);
|
||||
// FIXME: should use visit instead
|
||||
// could at least generalize this pattern
|
||||
|
|
|
@ -131,7 +131,7 @@ fn find_pre_post_exprs(&fn_ctxt fcx, &(@expr)[] args, node_id id) {
|
|||
seq_postconds(fcx, ivec::map(get_post, pps)));
|
||||
}
|
||||
|
||||
fn find_pre_post_loop(&fn_ctxt fcx, &@local l, &@expr index, &block body,
|
||||
fn find_pre_post_loop(&fn_ctxt fcx, &@local l, &@expr index, &blk body,
|
||||
node_id id) {
|
||||
find_pre_post_expr(fcx, index);
|
||||
find_pre_post_block(fcx, body);
|
||||
|
@ -152,7 +152,7 @@ fn find_pre_post_loop(&fn_ctxt fcx, &@local l, &@expr index, &block body,
|
|||
// Generates a pre/post assuming that a is the
|
||||
// annotation for an if-expression with consequent conseq
|
||||
// and alternative maybe_alt
|
||||
fn join_then_else(&fn_ctxt fcx, &@expr antec, &block conseq,
|
||||
fn join_then_else(&fn_ctxt fcx, &@expr antec, &blk conseq,
|
||||
&option::t[@expr] maybe_alt, node_id id, &if_ty chck) {
|
||||
find_pre_post_expr(fcx, antec);
|
||||
find_pre_post_block(fcx, conseq);
|
||||
|
@ -644,7 +644,7 @@ fn find_pre_post_stmt(&fn_ctxt fcx, &stmt s) {
|
|||
}
|
||||
}
|
||||
|
||||
fn find_pre_post_block(&fn_ctxt fcx, block b) {
|
||||
fn find_pre_post_block(&fn_ctxt fcx, blk b) {
|
||||
/* Want to say that if there is a break or cont in this
|
||||
block, then that invalidates the poststate upheld by
|
||||
any of the stmts after it.
|
||||
|
|
|
@ -177,7 +177,8 @@ fn find_pre_post_state_exprs(&fn_ctxt fcx, &prestate pres, node_id id,
|
|||
}
|
||||
|
||||
fn find_pre_post_state_loop(&fn_ctxt fcx, prestate pres, &@local l,
|
||||
&@expr index, &block body, node_id id) -> bool {
|
||||
&@expr index, &blk body, node_id id)
|
||||
-> bool {
|
||||
auto loop_pres = intersect_states(pres,
|
||||
block_poststate(fcx.ccx, body));
|
||||
|
||||
|
@ -217,7 +218,7 @@ fn gen_if_local(&fn_ctxt fcx, &poststate p, &@expr e) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn join_then_else(&fn_ctxt fcx, &@expr antec, &block conseq,
|
||||
fn join_then_else(&fn_ctxt fcx, &@expr antec, &blk conseq,
|
||||
&option::t[@expr] maybe_alt, node_id id, &if_ty chk,
|
||||
&prestate pres) -> bool {
|
||||
auto changed = set_prestate_ann(fcx.ccx, id, pres) |
|
||||
|
@ -692,7 +693,7 @@ fn find_pre_post_state_stmt(&fn_ctxt fcx, &prestate pres, @stmt s) -> bool {
|
|||
|
||||
/* Updates the pre- and post-states of statements in the block,
|
||||
returns a boolean flag saying whether any pre- or poststates changed */
|
||||
fn find_pre_post_state_block(&fn_ctxt fcx, &prestate pres0, &block b)
|
||||
fn find_pre_post_state_block(&fn_ctxt fcx, &prestate pres0, &blk b)
|
||||
-> bool {
|
||||
/* First, set the pre-states and post-states for every expression */
|
||||
|
||||
|
|
|
@ -1874,7 +1874,7 @@ fn ty_var_id(&ctxt cx, t typ) -> int {
|
|||
|
||||
|
||||
// Type accessors for AST nodes
|
||||
fn block_ty(&ctxt cx, &ast::block b) -> t {
|
||||
fn block_ty(&ctxt cx, &ast::blk b) -> t {
|
||||
ret node_id_to_type(cx, b.node.id);
|
||||
}
|
||||
|
||||
|
|
|
@ -1105,7 +1105,7 @@ mod writeback {
|
|||
fn visit_expr_pre(@wb_ctxt wbcx, &@ast::expr e) {
|
||||
resolve_type_vars_for_node(wbcx, e.span, e.id);
|
||||
}
|
||||
fn visit_block_pre(@wb_ctxt wbcx, &ast::block b) {
|
||||
fn visit_block_pre(@wb_ctxt wbcx, &ast::blk b) {
|
||||
resolve_type_vars_for_node(wbcx, b.span, b.node.id);
|
||||
}
|
||||
fn visit_pat_pre(@wb_ctxt wbcx, &@ast::pat p) {
|
||||
|
@ -1147,7 +1147,7 @@ mod writeback {
|
|||
}
|
||||
fn keep_going(@wb_ctxt wbcx) -> bool { !wbcx.ignore && wbcx.success }
|
||||
|
||||
fn resolve_type_vars_in_block(&@fn_ctxt fcx, &ast::block blk) -> bool {
|
||||
fn resolve_type_vars_in_block(&@fn_ctxt fcx, &ast::blk blk) -> bool {
|
||||
auto wbcx = @rec(fcx = fcx,
|
||||
mutable ignore = false,
|
||||
mutable success = true);
|
||||
|
@ -1628,7 +1628,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
|||
// A generic function for checking for or for-each loops
|
||||
|
||||
fn check_for_or_for_each(&@fn_ctxt fcx, &@ast::local local,
|
||||
&ty::t element_ty, &ast::block body,
|
||||
&ty::t element_ty, &ast::blk body,
|
||||
ast::node_id node_id) {
|
||||
check_decl_local(fcx, local);
|
||||
check_block(fcx, body);
|
||||
|
@ -1687,7 +1687,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
|
|||
|
||||
// A generic function for checking the then and else in an if
|
||||
// or if-check
|
||||
fn check_then_else(&@fn_ctxt fcx, &ast::block thn,
|
||||
fn check_then_else(&@fn_ctxt fcx, &ast::blk thn,
|
||||
&option::t[@ast::expr] elsopt,
|
||||
ast::node_id id, &span sp) {
|
||||
check_block(fcx, thn);
|
||||
|
@ -2598,7 +2598,7 @@ fn check_stmt(&@fn_ctxt fcx, &@ast::stmt stmt) {
|
|||
write::nil_ty(fcx.ccx.tcx, node_id);
|
||||
}
|
||||
|
||||
fn check_block(&@fn_ctxt fcx, &ast::block blk) {
|
||||
fn check_block(&@fn_ctxt fcx, &ast::blk blk) {
|
||||
for (@ast::stmt s in blk.node.stmts) { check_stmt(fcx, s); }
|
||||
alt (blk.node.expr) {
|
||||
case (none) { write::nil_ty(fcx.ccx.tcx, blk.node.id); }
|
||||
|
|
|
@ -116,9 +116,9 @@ tag meta_item_ {
|
|||
meta_name_value(ident, lit);
|
||||
}
|
||||
|
||||
type block = spanned[block_];
|
||||
type blk = spanned[blk_];
|
||||
|
||||
type block_ = rec((@stmt)[] stmts, option::t[@expr] expr, node_id id);
|
||||
type blk_ = rec((@stmt)[] stmts, option::t[@expr] expr, node_id id);
|
||||
|
||||
type pat = rec(node_id id,
|
||||
pat_ node,
|
||||
|
@ -260,7 +260,7 @@ type decl = spanned[decl_];
|
|||
|
||||
tag decl_ { decl_local((@local)[]); decl_item(@item); }
|
||||
|
||||
type arm = rec((@pat)[] pats, block block);
|
||||
type arm = rec((@pat)[] pats, blk block);
|
||||
|
||||
type elt = rec(mutability mut, @expr expr);
|
||||
|
||||
|
@ -291,15 +291,15 @@ tag expr_ {
|
|||
expr_unary(unop, @expr);
|
||||
expr_lit(@lit);
|
||||
expr_cast(@expr, @ty);
|
||||
expr_if(@expr, block, option::t[@expr]);
|
||||
expr_if(@expr, blk, option::t[@expr]);
|
||||
expr_ternary(@expr, @expr, @expr);
|
||||
expr_while(@expr, block);
|
||||
expr_for(@local, @expr, block);
|
||||
expr_for_each(@local, @expr, block);
|
||||
expr_do_while(block, @expr);
|
||||
expr_while(@expr, blk);
|
||||
expr_for(@local, @expr, blk);
|
||||
expr_for_each(@local, @expr, blk);
|
||||
expr_do_while(blk, @expr);
|
||||
expr_alt(@expr, arm[]);
|
||||
expr_fn(_fn);
|
||||
expr_block(block);
|
||||
expr_block(blk);
|
||||
/*
|
||||
* FIXME: many of these @exprs should be constrained with
|
||||
* is_lval once we have constrained types working.
|
||||
|
@ -328,7 +328,7 @@ tag expr_ {
|
|||
expr_check(check_mode, @expr);
|
||||
/* FIXME Would be nice if expr_check desugared
|
||||
to expr_if_check. */
|
||||
expr_if_check(@expr, block, option::t[@expr]);
|
||||
expr_if_check(@expr, blk, option::t[@expr]);
|
||||
expr_port(option::t[@ty]);
|
||||
expr_chan(@expr);
|
||||
expr_anon_obj(anon_obj);
|
||||
|
@ -340,7 +340,7 @@ type mac = spanned[mac_];
|
|||
tag mac_ {
|
||||
mac_invoc(path, (@expr)[], option::t[str]);
|
||||
mac_embed_type(@ty);
|
||||
mac_embed_block(block);
|
||||
mac_embed_block(blk);
|
||||
mac_ellipsis;
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ tag controlflow {
|
|||
|
||||
}
|
||||
|
||||
type _fn = rec(fn_decl decl, proto proto, block body);
|
||||
type _fn = rec(fn_decl decl, proto proto, blk body);
|
||||
|
||||
type method_ = rec(ident ident, _fn meth, node_id id);
|
||||
|
||||
|
@ -662,8 +662,8 @@ fn eq_ty(&@ty a, &@ty b) -> bool { ret std::box::ptr_eq(a, b); }
|
|||
|
||||
fn hash_ty(&@ty t) -> uint { ret t.span.lo << 16u + t.span.hi; }
|
||||
|
||||
fn block_from_expr(@expr e) -> block {
|
||||
let block_ blk_ =
|
||||
fn block_from_expr(@expr e) -> blk {
|
||||
auto blk_ =
|
||||
rec(stmts=~[],
|
||||
expr=option::some[@expr](e),
|
||||
id=e.id);
|
||||
|
|
|
@ -22,7 +22,7 @@ import ast::respan;
|
|||
import ast::ident;
|
||||
import ast::path;
|
||||
import ast::ty;
|
||||
import ast::block;
|
||||
import ast::blk;
|
||||
import ast::expr;
|
||||
import ast::expr_;
|
||||
import ast::path_;
|
||||
|
@ -56,7 +56,7 @@ tag matchable {
|
|||
match_path(path);
|
||||
match_ident(ast::spanned[ident]);
|
||||
match_ty(@ty);
|
||||
match_block(block);
|
||||
match_block(ast::blk);
|
||||
match_exact; /* don't bind anything, just verify the AST traversal */
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ type ast_fold_precursor =
|
|||
//unlike the others, item_ is non-trivial
|
||||
fn (&item_ i, ast_fold) -> item_ fold_item_underscore,
|
||||
fn (&method_ m, ast_fold) -> method_ fold_method,
|
||||
fn (&block_ b, ast_fold) -> block_ fold_block,
|
||||
fn (&blk_ b, ast_fold) -> blk_ fold_block,
|
||||
fn (&stmt_ s, ast_fold) -> stmt_ fold_stmt,
|
||||
fn (&arm a, ast_fold) -> arm fold_arm,
|
||||
fn (&pat_ p, ast_fold) -> pat_ fold_pat,
|
||||
|
@ -54,7 +54,7 @@ type a_f =
|
|||
fn (&@item i) -> @item fold_item,
|
||||
fn (&item_ i) -> item_ fold_item_underscore,
|
||||
fn (&@method m) -> @method fold_method,
|
||||
fn (&block b) -> block fold_block,
|
||||
fn (&blk b) -> blk fold_block,
|
||||
fn (&@stmt s) -> @stmt fold_stmt,
|
||||
fn (&arm a) -> arm fold_arm,
|
||||
fn (&@pat p) -> @pat fold_pat,
|
||||
|
@ -81,7 +81,7 @@ fn nf_native_item_dummy(&@native_item n) -> @native_item { fail; }
|
|||
fn nf_item_dummy(&@item i) -> @item { fail; }
|
||||
fn nf_item_underscore_dummy(&item_ i) -> item_ { fail; }
|
||||
fn nf_method_dummy(&@method m) -> @method { fail; }
|
||||
fn nf_block_dummy(&block b) -> block { fail; }
|
||||
fn nf_blk_dummy(&blk b) -> blk { fail; }
|
||||
fn nf_stmt_dummy(&@stmt s) -> @stmt { fail; }
|
||||
fn nf_arm_dummy(&arm a) -> arm { fail; }
|
||||
fn nf_pat_dummy(&@pat p) -> @pat { fail; }
|
||||
|
@ -259,7 +259,7 @@ fn noop_fold_method(&method_ m, ast_fold fld) -> method_ {
|
|||
}
|
||||
|
||||
|
||||
fn noop_fold_block(&block_ b, ast_fold fld) -> block_ {
|
||||
fn noop_fold_block(&blk_ b, ast_fold fld) -> blk_ {
|
||||
ret rec(stmts=ivec::map(fld.fold_stmt, b.stmts),
|
||||
expr=option::map(fld.fold_expr, b.expr), id=b.id);
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ fn dummy_out(ast_fold a) {
|
|||
fold_item = nf_item_dummy,
|
||||
fold_item_underscore = nf_item_underscore_dummy,
|
||||
fold_method = nf_method_dummy,
|
||||
fold_block = nf_block_dummy,
|
||||
fold_block = nf_blk_dummy,
|
||||
fold_stmt = nf_stmt_dummy,
|
||||
fold_arm = nf_arm_dummy,
|
||||
fold_pat = nf_pat_dummy,
|
||||
|
@ -608,7 +608,7 @@ fn make_fold(&ast_fold_precursor afp) -> ast_fold {
|
|||
fold_item = nf_item_dummy,
|
||||
fold_item_underscore = nf_item_underscore_dummy,
|
||||
fold_method = nf_method_dummy,
|
||||
fold_block = nf_block_dummy,
|
||||
fold_block = nf_blk_dummy,
|
||||
fold_stmt = nf_stmt_dummy,
|
||||
fold_arm = nf_arm_dummy,
|
||||
fold_pat = nf_pat_dummy,
|
||||
|
@ -653,7 +653,7 @@ fn make_fold(&ast_fold_precursor afp) -> ast_fold {
|
|||
fn f_method(&ast_fold_precursor afp, ast_fold f, &@method x) -> @method {
|
||||
ret @rec(node=afp.fold_method(x.node, f), span=x.span);
|
||||
}
|
||||
fn f_block(&ast_fold_precursor afp, ast_fold f, &block x) -> block {
|
||||
fn f_block(&ast_fold_precursor afp, ast_fold f, &blk x) -> blk {
|
||||
ret rec(node=afp.fold_block(x.node, f), span=x.span);
|
||||
}
|
||||
fn f_stmt(&ast_fold_precursor afp, ast_fold f, &@stmt x) -> @stmt {
|
||||
|
|
|
@ -1309,7 +1309,7 @@ fn parse_assign_expr(&parser p) -> @ast::expr {
|
|||
}
|
||||
|
||||
fn parse_if_expr_1(&parser p) -> tup(@ast::expr,
|
||||
ast::block, option::t[@ast::expr],
|
||||
ast::blk, option::t[@ast::expr],
|
||||
uint, uint) {
|
||||
auto lo = p.get_last_lo_pos();
|
||||
auto cond = parse_expr(p);
|
||||
|
@ -1754,13 +1754,13 @@ fn stmt_ends_with_semi(&ast::stmt stmt) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn parse_block(&parser p) -> ast::block {
|
||||
fn parse_block(&parser p) -> ast::blk {
|
||||
expect(p, token::LBRACE);
|
||||
be parse_block_tail(p);
|
||||
}
|
||||
|
||||
// some blocks start with "#{"...
|
||||
fn parse_block_tail(&parser p) -> ast::block {
|
||||
fn parse_block_tail(&parser p) -> ast::blk {
|
||||
auto lo = p.get_lo_pos();
|
||||
let (@ast::stmt)[] stmts = ~[];
|
||||
let option::t[@ast::expr] expr = none;
|
||||
|
@ -1912,7 +1912,7 @@ fn parse_method(&parser p) -> @ast::method {
|
|||
|
||||
fn parse_dtor(&parser p) -> @ast::method {
|
||||
auto lo = p.get_last_lo_pos();
|
||||
let ast::block b = parse_block(p);
|
||||
let ast::blk b = parse_block(p);
|
||||
let ast::arg[] inputs = ~[];
|
||||
let @ast::ty output = @spanned(lo, lo, ast::ty_nil);
|
||||
let ast::fn_decl d =
|
||||
|
|
|
@ -26,7 +26,7 @@ import pp::eof;
|
|||
// The ps is stored here to prevent recursive type.
|
||||
// FIXME use a nominal tag instead
|
||||
tag ann_node {
|
||||
node_block(ps, ast::block);
|
||||
node_block(ps, ast::blk);
|
||||
node_item(ps, @ast::item);
|
||||
node_expr(ps, @ast::expr);
|
||||
node_pat(ps, @ast::pat);
|
||||
|
@ -115,7 +115,7 @@ fn fun_to_str(&ast::_fn f, str name, &ast::ty_param[] params) -> str {
|
|||
ret writer.get_str();
|
||||
}
|
||||
|
||||
fn block_to_str(&ast::block blk) -> str {
|
||||
fn block_to_str(&ast::blk blk) -> str {
|
||||
auto writer = ioivec::string_writer();
|
||||
auto s = rust_printer(writer.get_writer());
|
||||
// containing cbox, will be closed by print-block at }
|
||||
|
@ -578,11 +578,11 @@ fn print_stmt(&ps s, &ast::stmt st) {
|
|||
maybe_print_trailing_comment(s, st.span, none[uint]);
|
||||
}
|
||||
|
||||
fn print_block(&ps s, &ast::block blk) {
|
||||
fn print_block(&ps s, &ast::blk blk) {
|
||||
print_possibly_embedded_block(s, blk, false, indent_unit);
|
||||
}
|
||||
|
||||
fn print_possibly_embedded_block(&ps s, &ast::block blk, bool embedded,
|
||||
fn print_possibly_embedded_block(&ps s, &ast::blk blk, bool embedded,
|
||||
uint indented) {
|
||||
maybe_print_comment(s, blk.span.lo);
|
||||
auto ann_node = node_block(s, blk);
|
||||
|
@ -605,7 +605,7 @@ fn print_possibly_embedded_block(&ps s, &ast::block blk, bool embedded,
|
|||
s.ann.post(ann_node);
|
||||
}
|
||||
|
||||
fn print_if(&ps s, &@ast::expr test, &ast::block blk,
|
||||
fn print_if(&ps s, &@ast::expr test, &ast::blk blk,
|
||||
&option::t[@ast::expr] elseopt, bool chk) {
|
||||
head(s, "if");
|
||||
if (chk) {
|
||||
|
|
|
@ -23,7 +23,7 @@ type visitor[E] =
|
|||
fn(&@native_item, &E, &vt[E]) visit_native_item,
|
||||
fn(&@item, &E, &vt[E]) visit_item,
|
||||
fn(&@local, &E, &vt[E]) visit_local,
|
||||
fn(&block, &E, &vt[E]) visit_block,
|
||||
fn(&ast::blk, &E, &vt[E]) visit_block,
|
||||
fn(&@stmt, &E, &vt[E]) visit_stmt,
|
||||
fn(&arm, &E, &vt[E]) visit_arm,
|
||||
fn(&@pat, &E, &vt[E]) visit_pat,
|
||||
|
@ -234,7 +234,7 @@ fn visit_fn[E](&_fn f, &ty_param[] tp, &span sp, &fn_ident i,
|
|||
v.visit_block(f.body, e, v);
|
||||
}
|
||||
|
||||
fn visit_block[E](&block b, &E e, &vt[E] v) {
|
||||
fn visit_block[E](&ast::blk b, &E e, &vt[E] v) {
|
||||
for (@stmt s in b.node.stmts) { v.visit_stmt(s, e, v); }
|
||||
visit_expr_opt(b.node.expr, e, v);
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ type ast_visitor =
|
|||
fn(&@ast::item) visit_item_post,
|
||||
fn(&@ast::method) visit_method_pre,
|
||||
fn(&@ast::method) visit_method_post,
|
||||
fn(&ast::block) visit_block_pre,
|
||||
fn(&ast::block) visit_block_post,
|
||||
fn(&ast::blk) visit_block_pre,
|
||||
fn(&ast::blk) visit_block_post,
|
||||
fn(&@ast::stmt) visit_stmt_pre,
|
||||
fn(&@ast::stmt) visit_stmt_post,
|
||||
fn(&ast::arm) visit_arm_pre,
|
||||
|
@ -231,7 +231,7 @@ fn walk_fn(&ast_visitor v, &ast::_fn f, &ast::ty_param[] tps,
|
|||
v.visit_fn_post(f, tps, sp, i, d);
|
||||
}
|
||||
|
||||
fn walk_block(&ast_visitor v, &ast::block b) {
|
||||
fn walk_block(&ast_visitor v, &ast::blk b) {
|
||||
if (!v.keep_going()) { ret; }
|
||||
v.visit_block_pre(b);
|
||||
for (@ast::stmt s in b.node.stmts) { walk_stmt(v, s); }
|
||||
|
@ -440,7 +440,7 @@ fn def_visit_item(&@ast::item i) { }
|
|||
|
||||
fn def_visit_method(&@ast::method m) { }
|
||||
|
||||
fn def_visit_block(&ast::block b) { }
|
||||
fn def_visit_block(&ast::blk b) { }
|
||||
|
||||
fn def_visit_stmt(&@ast::stmt s) { }
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@ fn log_ty_err(&ty t) { log_err print::pprust::ty_to_str(t); }
|
|||
|
||||
fn log_pat_err(&@pat p) { log_err print::pprust::pat_to_str(p); }
|
||||
|
||||
fn log_block(&ast::block b) { log print::pprust::block_to_str(b); }
|
||||
fn log_block(&ast::blk b) { log print::pprust::block_to_str(b); }
|
||||
|
||||
fn log_block_err(&ast::block b) { log_err print::pprust::block_to_str(b); }
|
||||
fn log_block_err(&ast::blk b) { log_err print::pprust::block_to_str(b); }
|
||||
|
||||
fn log_item_err(&@ast::item i) { log_err print::pprust::item_to_str(i); }
|
||||
|
||||
|
@ -89,7 +89,7 @@ fn log_stmt(&ast::stmt st) { log print::pprust::stmt_to_str(st); }
|
|||
|
||||
fn log_stmt_err(&ast::stmt st) { log_err print::pprust::stmt_to_str(st); }
|
||||
|
||||
fn has_nonlocal_exits(&ast::block b) -> bool {
|
||||
fn has_nonlocal_exits(&ast::blk b) -> bool {
|
||||
auto has_exits = @mutable false;
|
||||
fn visit_expr(@mutable bool flag, &@ast::expr e) {
|
||||
alt (e.node) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue