Fix a couple of problems

This commit is contained in:
greg 2017-01-10 10:32:56 -08:00
parent 825c271b17
commit d6fc13f08d
1 changed files with 5 additions and 2 deletions

View File

@ -168,7 +168,7 @@ impl CodeGen for Expression {
zero,
"is_nonzero");
let func = 4;
let func: LLVMValueRef = zero;
let then_block =
LLVMWrap::AppendBasicBlockInContext(data.context, func, "entry");
let else_block =
@ -179,7 +179,10 @@ impl CodeGen for Expression {
LLVMWrap::PositionBuilderAtEnd(data.builder, then_block);
let then_return = then_expr.codegen(data);
LLVMWrap::BuildBr(data.builder, merge_block);
let else_return = else_expr.codegen(data);
let else_return = match else_expr {
&Some(e) => e.codegen(data),
&None => zero,
};
LLVMWrap::BuildBr(data.builder, merge_block);
LLVMWrap::PositionBuilderAtEnd(data.builder, else_block);
zero