about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <andersrb@gmail.com>2011-03-10 23:39:18 -0500
committerBrian Anderson <andersrb@gmail.com>2011-03-13 19:29:40 -0400
commit2a662944a4d87c6d82299a181996ba14170b2ebb (patch)
tree35041b42bb553e3dc778b1419596b751a85362a8
parent9fc4db6b89213afdf45c02fc2bd2be62b0ddc40c (diff)
Remove extra blocks from the translation of expr_block
Doesn't seem to break anything and allows trans_if to be streamlined
-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 728f20dd0eb..87f01609a38 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)) {