Only do the if-else chain for type switch on wasm targets

This commit is contained in:
gingerBill
2025-11-22 13:53:04 +00:00
parent c9f69aa5b4
commit a2b0244652

View File

@@ -1982,11 +1982,13 @@ gb_internal void lb_build_type_switch_stmt(lbProcedure *p, AstTypeSwitchStmt *ss
if (type_size_of(parent_base_type) == 0) {
GB_ASSERT(tag.value == nullptr);
switch_instr = LLVMBuildSwitch(p->builder, lb_const_bool(p->module, t_llvm_bool, false).value, else_block->block, cast(unsigned)num_cases);
} else if (switch_kind == TypeSwitch_Union) {
} else {
GB_ASSERT(tag.value != nullptr);
switch_instr = LLVMBuildSwitch(p->builder, tag.value, else_block->block, cast(unsigned)num_cases);
} else if (switch_kind == TypeSwitch_Any) {
// gb_printf_err("HERE!\n");
if (switch_kind == TypeSwitch_Any && is_arch_wasm()) {
// Only do the if-else chain on wasm targets
} else {
switch_instr = LLVMBuildSwitch(p->builder, tag.value, else_block->block, cast(unsigned)num_cases);
}
}
bool all_by_reference = false;