Fix a couple of problems
This commit is contained in:
parent
825c271b17
commit
d6fc13f08d
@ -168,7 +168,7 @@ impl CodeGen for Expression {
|
|||||||
zero,
|
zero,
|
||||||
"is_nonzero");
|
"is_nonzero");
|
||||||
|
|
||||||
let func = 4;
|
let func: LLVMValueRef = zero;
|
||||||
let then_block =
|
let then_block =
|
||||||
LLVMWrap::AppendBasicBlockInContext(data.context, func, "entry");
|
LLVMWrap::AppendBasicBlockInContext(data.context, func, "entry");
|
||||||
let else_block =
|
let else_block =
|
||||||
@ -179,7 +179,10 @@ impl CodeGen for Expression {
|
|||||||
LLVMWrap::PositionBuilderAtEnd(data.builder, then_block);
|
LLVMWrap::PositionBuilderAtEnd(data.builder, then_block);
|
||||||
let then_return = then_expr.codegen(data);
|
let then_return = then_expr.codegen(data);
|
||||||
LLVMWrap::BuildBr(data.builder, merge_block);
|
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::BuildBr(data.builder, merge_block);
|
||||||
LLVMWrap::PositionBuilderAtEnd(data.builder, else_block);
|
LLVMWrap::PositionBuilderAtEnd(data.builder, else_block);
|
||||||
zero
|
zero
|
||||||
|
Loading…
Reference in New Issue
Block a user