Skip to content

Commit 4c7be32

Browse files
committed
add node_ids to blocks
1 parent e139793 commit 4c7be32

File tree

5 files changed

+167
-108
lines changed

5 files changed

+167
-108
lines changed

src/rustc/middle/trans/alt.rs

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,10 @@ fn compile_submatch(bcx: block, m: match, vals: [ValueRef],
370370
let loc = local_mem(option::get(assoc(key, m[0].bound)));
371371
bcx.fcx.lllocals.insert(val, loc);
372372
};
373-
let {bcx: guard_cx, val} = with_scope_result(bcx, "guard") {|bcx|
374-
trans_temp_expr(bcx, e)
373+
let {bcx: guard_cx, val} = {
374+
with_scope_result(bcx, e.info(), "guard") {|bcx|
375+
trans_temp_expr(bcx, e)
376+
}
375377
};
376378
bcx = with_cond(guard_cx, Not(guard_cx, val)) {|bcx|
377379
compile_submatch(bcx, vec::tail(m), vals, chk, exits);
@@ -517,19 +519,20 @@ fn compile_submatch(bcx: block, m: match, vals: [ValueRef],
517519
}
518520
compare {
519521
let t = node_id_type(bcx, pat_id);
520-
let {bcx: after_cx, val: matches} =
521-
with_scope_result(bcx, "compare_scope") {|bcx|
522-
alt trans_opt(bcx, opt) {
523-
single_result({bcx, val}) {
524-
trans_compare(bcx, ast::eq, test_val, t, val, t)
525-
}
526-
range_result({val: vbegin, _}, {bcx, val: vend}) {
527-
let {bcx, val: ge} = trans_compare(
528-
bcx, ast::ge, test_val, t, vbegin, t);
529-
let {bcx, val: le} = trans_compare(
530-
bcx, ast::le, test_val, t, vend, t);
531-
{bcx: bcx, val: And(bcx, ge, le)}
532-
}
522+
let {bcx: after_cx, val: matches} = {
523+
with_scope_result(bcx, none, "compare_scope") {|bcx|
524+
alt trans_opt(bcx, opt) {
525+
single_result({bcx, val}) {
526+
trans_compare(bcx, ast::eq, test_val, t, val, t)
527+
}
528+
range_result({val: vbegin, _}, {bcx, val: vend}) {
529+
let {bcx, val: ge} = trans_compare(
530+
bcx, ast::ge, test_val, t, vbegin, t);
531+
let {bcx, val: le} = trans_compare(
532+
bcx, ast::le, test_val, t, vend, t);
533+
{bcx: bcx, val: And(bcx, ge, le)}
534+
}
535+
}
533536
}
534537
};
535538
bcx = sub_block(after_cx, "compare_next");
@@ -608,10 +611,14 @@ fn make_phi_bindings(bcx: block, map: [exit_node],
608611
ret success;
609612
}
610613

611-
fn trans_alt(bcx: block, expr: @ast::expr, arms: [ast::arm],
612-
mode: ast::alt_mode, dest: dest) -> block {
614+
fn trans_alt(bcx: block,
615+
alt_expr: @ast::expr,
616+
expr: @ast::expr,
617+
arms: [ast::arm],
618+
mode: ast::alt_mode,
619+
dest: dest) -> block {
613620
let _icx = bcx.insn_ctxt("alt::trans_alt");
614-
with_scope(bcx, "alt") {|bcx|
621+
with_scope(bcx, alt_expr.info(), "alt") {|bcx|
615622
trans_alt_inner(bcx, expr, arms, mode, dest)
616623
}
617624
}
@@ -626,8 +633,7 @@ fn trans_alt_inner(scope_cx: block, expr: @ast::expr, arms: [ast::arm],
626633
if bcx.unreachable { ret bcx; }
627634

628635
for vec::each(arms) {|a|
629-
let body = scope_block(bcx, "case_body");
630-
body.block_span = some(a.body.span);
636+
let body = scope_block(bcx, a.body.info(), "case_body");
631637
let id_map = pat_util::pat_id_map(tcx.def_map, a.pats[0]);
632638
bodies += [body];
633639
for vec::each(a.pats) {|p|

0 commit comments

Comments
 (0)