Skip to content

Commit 1f7562c

Browse files
committed
---
yaml --- r: 15805 b: refs/heads/try c: 4c7be32 h: refs/heads/master i: 15803: b4ba0af v: v3
1 parent dd5c466 commit 1f7562c

File tree

6 files changed

+168
-109
lines changed

6 files changed

+168
-109
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: e1397933130fcc3f6d9274894be7d43d881c7072
5+
refs/heads/try: 4c7be32606f023c5a9f298d43a0b6617147cafa8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/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)