Skip to content

Commit 2a66294

Browse files
committed
Remove extra blocks from the translation of expr_block
Doesn't seem to break anything and allows trans_if to be streamlined
1 parent 9fc4db6 commit 2a66294

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/comp/middle/trans.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -2683,18 +2683,7 @@ fn trans_if(@block_ctxt cx, @ast.expr cond,
26832683

26842684
alt (els) {
26852685
case (some[@ast.expr](?elexpr)) {
2686-
// FIXME: Shouldn't need to unwrap the block here,
2687-
// instead just use 'else_res = trans_expr(else_cx, elexpr)',
2688-
// but either a) trans_expr doesn't handle expr_block
2689-
// correctly or b) I have no idea what I'm doing...
2690-
alt (elexpr.node) {
2691-
case (ast.expr_if(_, _, _, _)) {
2692-
else_res = trans_expr(else_cx, elexpr);
2693-
}
2694-
case (ast.expr_block(?b, _)) {
2695-
else_res = trans_block(else_cx, b);
2696-
}
2697-
}
2686+
else_res = trans_expr(else_cx, elexpr);
26982687
}
26992688
case (_) { /* fall through */ }
27002689
}
@@ -3942,14 +3931,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
39423931
}
39433932

39443933
case (ast.expr_block(?blk, _)) {
3945-
auto sub_cx = new_scope_block_ctxt(cx, "block-expr body");
3946-
auto next_cx = new_sub_block_ctxt(cx, "next");
3947-
auto sub = trans_block(sub_cx, blk);
3948-
3949-
cx.build.Br(sub_cx.llbb);
3950-
sub.bcx.build.Br(next_cx.llbb);
3951-
3952-
ret res(next_cx, sub.val);
3934+
ret trans_block(cx, blk);
39533935
}
39543936

39553937
case (ast.expr_assign(?dst, ?src, ?ann)) {

0 commit comments

Comments
 (0)