Update Tilde

This commit is contained in:
gingerBill
2023-08-19 12:26:59 +01:00
parent 15033eab28
commit 0cb9908f27
9 changed files with 83 additions and 52 deletions

View File

@@ -305,13 +305,12 @@ gb_internal void cg_procedure_begin(cgProcedure *p) {
param_ptr_to_use = dummy_param;
param_debug_type = tb_debug_create_ptr(p->module->mod, param_debug_type);
}
tb_node_append_attrib(
tb_function_attrib_variable(
p->func,
param_ptr_to_use,
tb_function_attrib_variable(
p->func,
name.len, cast(char const *)name.text,
param_debug_type
)
nullptr, // parent
name.len, cast(char const *)name.text,
param_debug_type
);
}
cgAddr addr = cg_addr(local);
@@ -1097,8 +1096,25 @@ gb_internal cgProcedure *cg_equal_proc_for_type(cgModule *m, Type *type) {
cg_emit_if(p, tag_eq, switch_region, false_region);
size_t entry_count = type->Union.variants.count;
if (type->Union.kind != UnionType_no_nil) {
entry_count += 1;
}
size_t entry_index = 0;
TB_SwitchEntry *keys = gb_alloc_array(temporary_allocator(), TB_SwitchEntry, entry_count);
for (size_t i = 0; i < entry_count; i++) {
if (type->Union.kind != UnionType_no_nil) {
TB_Node *region = cg_control_region(p, "bcase");
keys[entry_index].key = 0;
keys[entry_index].value = region;
entry_index += 1;
tb_inst_set_control(p->func, region);
cgValue ok = cg_const_bool(p, t_bool, true);
cg_build_return_stmt_internal_single(p, ok);
}
for (size_t i = entry_index; i < entry_count; i++) {
TB_Node *region = cg_control_region(p, "bcase");
Type *variant = type->Union.variants[i];
keys[i].key = union_variant_index(type, variant);