diff --git a/src/compiler.bbb b/src/compiler.bbb index e22431b..3d7a812 100644 --- a/src/compiler.bbb +++ b/src/compiler.bbb @@ -2036,6 +2036,11 @@ value_is_constant = fn (value: &Value) u1 { return 0; }, + .aggregate_initialization => + { + assert(value.type != zero); + return value.content.aggregate_initialization.is_constant; + }, else => { #trap(); @@ -11053,6 +11058,23 @@ emit_string_literal = fn (module: &Module, value: &Value) [2]&LLVMValue emit_assignment = fn (module: &Module, left_llvm: &LLVMValue, left_type: &Type, right: &Value) void { + >parent_function_global: &Global = undefined; + if (module.current_function) + { + parent_function_global = module.current_function; + } + else if (module.current_macro_instantiation) + { + #trap(); + } + else + { + report_error(); + } + + >llvm_function = parent_function_global.variable.storage.llvm; + assert(llvm_function != zero); + assert(right.llvm == zero); >pointer_type = left_type; @@ -11180,7 +11202,8 @@ emit_assignment = fn (module: &Module, left_llvm: &LLVMValue, left_type: &Type, }, else => { - #trap(); + >result = emit_va_arg(module, right, left_llvm, left_type, llvm_function); + assert(result == left_llvm); }, } }, @@ -12510,7 +12533,7 @@ emit = fn (module: &Module) void } else { - #trap(); + emit_block(module, return_block); } } else @@ -12959,6 +12982,8 @@ names: [_][]u8 = "if_no_else", "if_no_else_void", "indirect", + "indirect_struct", + "indirect_varargs", ]; [export] main = fn [cc(c)] (argument_count: u32, argv: &&u8, envp: &&u8) s32