aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-03-10 23:39:18 -0500
committerBrian Anderson <[email protected]>2011-03-13 19:29:40 -0400
commit2a662944a4d87c6d82299a181996ba14170b2ebb (patch)
tree35041b42bb553e3dc778b1419596b751a85362a8 /src
parentMerge branch 'master' into recursive-elseif (diff)
downloadrust-2a662944a4d87c6d82299a181996ba14170b2ebb.tar.xz
rust-2a662944a4d87c6d82299a181996ba14170b2ebb.zip
Remove extra blocks from the translation of expr_block
Doesn't seem to break anything and allows trans_if to be streamlined
Diffstat (limited to 'src')
-rw-r--r--src/comp/middle/trans.rs22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 728f20dd..87f01609 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -2683,18 +2683,7 @@ fn trans_if(@block_ctxt cx, @ast.expr cond,
alt (els) {
case (some[@ast.expr](?elexpr)) {
- // FIXME: Shouldn't need to unwrap the block here,
- // instead just use 'else_res = trans_expr(else_cx, elexpr)',
- // but either a) trans_expr doesn't handle expr_block
- // correctly or b) I have no idea what I'm doing...
- alt (elexpr.node) {
- case (ast.expr_if(_, _, _, _)) {
- else_res = trans_expr(else_cx, elexpr);
- }
- case (ast.expr_block(?b, _)) {
- else_res = trans_block(else_cx, b);
- }
- }
+ else_res = trans_expr(else_cx, elexpr);
}
case (_) { /* fall through */ }
}
@@ -3942,14 +3931,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
}
case (ast.expr_block(?blk, _)) {
- auto sub_cx = new_scope_block_ctxt(cx, "block-expr body");
- auto next_cx = new_sub_block_ctxt(cx, "next");
- auto sub = trans_block(sub_cx, blk);
-
- cx.build.Br(sub_cx.llbb);
- sub.bcx.build.Br(next_cx.llbb);
-
- ret res(next_cx, sub.val);
+ ret trans_block(cx, blk);
}
case (ast.expr_assign(?dst, ?src, ?ann)) {