mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 11:13:08 +00:00
report compile errors instead of crashing when frame is invalid
This commit is contained in:
parent
28dbdba37e
commit
ad92227516
@ -2003,6 +2003,8 @@ bool type_is_invalid(ZigType *type_entry) {
|
|||||||
return type_entry->data.unionation.resolve_status == ResolveStatusInvalid;
|
return type_entry->data.unionation.resolve_status == ResolveStatusInvalid;
|
||||||
case ZigTypeIdEnum:
|
case ZigTypeIdEnum:
|
||||||
return type_entry->data.enumeration.resolve_status == ResolveStatusInvalid;
|
return type_entry->data.enumeration.resolve_status == ResolveStatusInvalid;
|
||||||
|
case ZigTypeIdFnFrame:
|
||||||
|
return type_entry->data.frame.reported_loop_err;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17061,6 +17061,8 @@ static Error ir_result_has_type(IrAnalyze *ira, ResultLoc *result_loc, bool *out
|
|||||||
static IrInstruction *ir_resolve_no_result_loc(IrAnalyze *ira, IrInstruction *suspend_source_instr,
|
static IrInstruction *ir_resolve_no_result_loc(IrAnalyze *ira, IrInstruction *suspend_source_instr,
|
||||||
ResultLoc *result_loc, ZigType *value_type, bool force_runtime, bool non_null_comptime)
|
ResultLoc *result_loc, ZigType *value_type, bool force_runtime, bool non_null_comptime)
|
||||||
{
|
{
|
||||||
|
if (type_is_invalid(value_type))
|
||||||
|
return ira->codegen->invalid_instruction;
|
||||||
IrInstructionAllocaGen *alloca_gen = ir_build_alloca_gen(ira, suspend_source_instr, 0, "");
|
IrInstructionAllocaGen *alloca_gen = ir_build_alloca_gen(ira, suspend_source_instr, 0, "");
|
||||||
alloca_gen->base.value->type = get_pointer_to_type_extra(ira->codegen, value_type, false, false,
|
alloca_gen->base.value->type = get_pointer_to_type_extra(ira->codegen, value_type, false, false,
|
||||||
PtrLenSingle, 0, 0, 0, false);
|
PtrLenSingle, 0, 0, 0, false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user