Rename a field (so that macros can mention it).

This commit is contained in:
Paul Stansifer 2011-08-10 15:38:41 -07:00
parent b803326063
commit d2f9b15052
9 changed files with 13 additions and 13 deletions

View file

@ -504,7 +504,7 @@ fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &[ast::arm],
for a: ast::arm in arms {
let body_cx = bodies.(i);
if make_phi_bindings(body_cx, exit_map, ast::pat_id_map(a.pats.(0))) {
let block_res = trans::trans_block(body_cx, a.block, output);
let block_res = trans::trans_block(body_cx, a.body, output);
arm_results += ~[block_res];
} else { // Unreachable
arm_results += ~[rslt(body_cx, C_nil())];

View file

@ -504,8 +504,8 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) {
expr_alt(ex, alts) {
find_pre_post_expr(fcx, ex);
fn do_an_alt(fcx: &fn_ctxt, an_alt: &arm) -> pre_and_post {
find_pre_post_block(fcx, an_alt.block);
ret block_pp(fcx.ccx, an_alt.block);
find_pre_post_block(fcx, an_alt.body);
ret block_pp(fcx.ccx, an_alt.body);
}
let alt_pps = ~[];
for a: arm in alts { alt_pps += ~[do_an_alt(fcx, a)]; }

View file

@ -555,8 +555,8 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) ->
a_post = false_postcond(num_constrs);
for an_alt: arm in alts {
changed |=
find_pre_post_state_block(fcx, e_post, an_alt.block);
intersect(a_post, block_poststate(fcx.ccx, an_alt.block));
find_pre_post_state_block(fcx, e_post, an_alt.body);
intersect(a_post, block_poststate(fcx.ccx, an_alt.body));
// We deliberately do *not* update changed here, because
// we'd go into an infinite loop that way, and the change
// gets made after the if expression.

View file

@ -2033,9 +2033,9 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
let result_ty = next_ty_var(fcx);
let arm_non_bot = false;
for arm: ast::arm in arms {
if !check_block(fcx, arm.block) { arm_non_bot = true; }
let bty = block_ty(tcx, arm.block);
result_ty = demand::simple(fcx, arm.block.span, result_ty, bty);
if !check_block(fcx, arm.body) { arm_non_bot = true; }
let bty = block_ty(tcx, arm.body);
result_ty = demand::simple(fcx, arm.body.span, result_ty, bty);
}
bot |= !arm_non_bot;
if !arm_non_bot { result_ty = ty::mk_bot(tcx); }

View file

@ -269,7 +269,7 @@ type decl = spanned[decl_];
tag decl_ { decl_local([@local]); decl_item(@item); }
type arm = {pats: [@pat], block: blk};
type arm = {pats: [@pat], body: blk};
type field_ = {mut: mutability, ident: ident, expr: @expr};

View file

@ -268,7 +268,7 @@ fn noop_fold_stmt(s: &stmt_, fld: ast_fold) -> stmt_ {
fn noop_fold_arm(a: &arm, fld: ast_fold) -> arm {
ret {pats: ivec::map(fld.fold_pat, a.pats),
block: fld.fold_block(a.block)};
body: fld.fold_block(a.body)};
}
fn noop_fold_pat(p: &pat_, fld: ast_fold) -> pat_ {

View file

@ -1356,7 +1356,7 @@ fn parse_alt_expr(p: &parser) -> @ast::expr {
while p.peek() != token::RBRACE {
let pats = parse_pats(p);
let blk = parse_block(p);
arms += ~[{pats: pats, block: blk}];
arms += ~[{pats: pats, body: blk}];
}
let hi = p.get_hi_pos();
p.bump();

View file

@ -863,7 +863,7 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
print_pat(s, p);
}
space(s.s);
print_possibly_embedded_block(s, arm.block, false,
print_possibly_embedded_block(s, arm.body, false,
alt_indent_unit);
}
bclose_(s, expr.span, alt_indent_unit);

View file

@ -347,7 +347,7 @@ fn visit_expr[E](ex: &@expr, e: &E, v: &vt[E]) {
fn visit_arm[E](a: &arm, e: &E, v: &vt[E]) {
for p: @pat in a.pats { v.visit_pat(p, e, v); }
v.visit_block(a.block, e, v);
v.visit_block(a.body, e, v);
}
// Simpler, non-context passing interface. Always walks the whole tree, simply