final touchups

This commit is contained in:
Folkert 2020-09-21 23:57:05 +02:00
parent 515f717536
commit 9ac5533f80

View File

@ -1372,15 +1372,6 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
builder.build_conditional_branch(value, then_block, else_block);
// build else block
builder.position_at_end(else_block);
let else_val = build_exp_stmt(env, layout_ids, scope, parent, fail_stmt);
if else_block.get_terminator().is_none() {
let else_block = builder.get_insert_block().unwrap();
builder.build_unconditional_branch(cont_block);
blocks.push((&else_val, else_block));
}
// build then block
builder.position_at_end(then_block);
let then_val = build_exp_stmt(env, layout_ids, scope, parent, pass_stmt);
@ -1390,6 +1381,15 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
blocks.push((&then_val, then_block));
}
// build else block
builder.position_at_end(else_block);
let else_val = build_exp_stmt(env, layout_ids, scope, parent, fail_stmt);
if else_block.get_terminator().is_none() {
let else_block = builder.get_insert_block().unwrap();
builder.build_unconditional_branch(cont_block);
blocks.push((&else_val, else_block));
}
// emit merge block
if blocks.is_empty() {
// SAFETY there are no other references to this block in this case
@ -2427,7 +2427,6 @@ fn build_int_binop<'a, 'ctx, 'env>(
match op {
NumAdd => {
// TODO
let builder = env.builder;
let context = env.context;