diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-06-23 00:41:11 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-06-23 00:41:11 -0400 |
| commit | 38568318a087394f02cba21a9617098ccb8b58ee (patch) | |
| tree | f5f6ace3c6f3ad8dc1d26ffa79613fe37dffd908 /src/ir.cpp | |
| parent | 7e303fa28feaa10d7dbf08fdc3e86c47bba882e6 (diff) | |
| download | zig-38568318a087394f02cba21a9617098ccb8b58ee.tar.gz zig-38568318a087394f02cba21a9617098ccb8b58ee.zip | |
fix some legacy coroutine stuff
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index f73c3f0d45..32e3692afd 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -15289,6 +15289,21 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn if (result_loc != nullptr) return result_loc; + ZigFn *fn = exec_fn_entry(ira->new_irb.exec); + if (fn != nullptr && fn->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync && + instruction->result_loc->id == ResultLocIdReturn) + { + result_loc = ir_resolve_result(ira, &instruction->base, no_result_loc(), + implicit_elem_type, nullptr, false, true); + if (result_loc != nullptr && + (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) + { + return result_loc; + } + result_loc->value.special = ConstValSpecialRuntime; + return result_loc; + } + IrInstruction *result = ir_const(ira, &instruction->base, implicit_elem_type); result->value.special = ConstValSpecialUndef; IrInstruction *ptr = ir_get_ref(ira, &instruction->base, result, false, false); @@ -16128,7 +16143,9 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c if (handle_is_ptr(impl_fn_type_id->return_type)) { result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, impl_fn_type_id->return_type, nullptr, true, true); - if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { + if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || + instr_is_unreachable(result_loc))) + { return result_loc; } } else { @@ -16248,7 +16265,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c if (handle_is_ptr(return_type)) { result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, return_type, nullptr, true, true); - if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { + if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) { return result_loc; } } else { |
