pass void parameters test
parent
23bebdbcd5
commit
46033a2128
|
@ -2234,7 +2234,10 @@ static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry) {
|
|||
VariableTableEntry *var = add_variable(g, param_decl_node, fn_table_entry->child_scope, param_decl->name, param_type, true, nullptr);
|
||||
var->src_arg_index = i;
|
||||
fn_table_entry->child_scope = var->child_scope;
|
||||
fn_table_entry->variable_list.append(var);
|
||||
|
||||
if (type_has_bits(param_type)) {
|
||||
fn_table_entry->variable_list.append(var);
|
||||
}
|
||||
|
||||
if (fn_type->data.fn.gen_param_info) {
|
||||
var->gen_arg_index = fn_type->data.fn.gen_param_info[i].gen_index;
|
||||
|
|
|
@ -1650,6 +1650,9 @@ static LLVMValueRef ir_render_switch_br(CodeGen *g, IrExecutable *executable, Ir
|
|||
}
|
||||
|
||||
static LLVMValueRef ir_render_phi(CodeGen *g, IrExecutable *executable, IrInstructionPhi *instruction) {
|
||||
if (!type_has_bits(instruction->base.type_entry))
|
||||
return nullptr;
|
||||
|
||||
LLVMTypeRef phi_type;
|
||||
if (handle_is_ptr(instruction->base.type_entry)) {
|
||||
phi_type = LLVMPointerType(instruction->base.type_entry->type_ref, 0);
|
||||
|
|
|
@ -19,6 +19,17 @@ fn testLocVars(b: i32) {
|
|||
}
|
||||
|
||||
|
||||
fn voidParameters() {
|
||||
@setFnTest(this);
|
||||
|
||||
voidFun(1, void{}, 2, {});
|
||||
}
|
||||
fn voidFun(a: i32, b: void, c: i32, d: void) {
|
||||
const v = b;
|
||||
const vv: void = if (a == 1) {v} else {};
|
||||
assert(a + c == 3);
|
||||
return vv;
|
||||
}
|
||||
|
||||
|
||||
// TODO const assert = @import("std").debug.assert;
|
||||
|
|
|
@ -17,18 +17,6 @@ const test_this = @import("cases/this.zig");
|
|||
|
||||
|
||||
|
||||
fn voidParameters() {
|
||||
@setFnTest(this);
|
||||
|
||||
voidFun(1, void{}, 2, {});
|
||||
}
|
||||
fn voidFun(a: i32, b: void, c: i32, d: void) {
|
||||
const v = b;
|
||||
const vv: void = if (a == 1) {v} else {};
|
||||
assert(a + c == 3);
|
||||
return vv;
|
||||
}
|
||||
|
||||
fn mutableLocalVariables() {
|
||||
@setFnTest(this, true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue