example: function calls can't happen on consts yet

- add suggestion to make it work as TODO
This commit is contained in:
Luna 2019-09-25 18:10:17 -03:00
parent 0b72462954
commit e69451cdd9
2 changed files with 8 additions and 1 deletions

View File

@ -4,8 +4,12 @@ fn f() i32 {
return 2;
}
fn f2() i32 {
return f() + 2;
}
const (
piss = f() + 3
piss = 1 + 3
)
enum B {

View File

@ -371,6 +371,9 @@ pub const Codegen = struct {
var global = llvm.LLVMAddGlobal(mod, const_llvm_type, const_name.ptr);
// TODO maybe put builder at main function so we can still
// call other functions inside consts?
var builder = llvm.LLVMCreateBuilder();
var expr_llvm_val = try self.emitExpr(builder, constdecl.expr);