From 237233b04bdbbb82a5ce881a074fdd4ca55fe58f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 20 Jun 2019 18:15:27 -0400 Subject: fix coroutines --- src/ir.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 4dbc20cf48..c3ed14770f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -15252,8 +15252,14 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc ZigType *promise_type = get_promise_type(ira->codegen, return_type); ZigType *async_return_type = get_error_union_type(ira->codegen, alloc_fn_error_set_type, promise_type); + IrInstruction *result_loc = ir_resolve_result(ira, &call_instruction->base, no_result_loc(), + async_return_type, nullptr, true, true); + if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { + return result_loc; + } + return ir_build_call_gen(ira, &call_instruction->base, fn_entry, fn_ref, arg_count, - casted_args, FnInlineAuto, true, async_allocator_inst, nullptr, nullptr, + casted_args, FnInlineAuto, true, async_allocator_inst, nullptr, result_loc, async_return_type); } -- cgit v1.2.3