Implement noasync awaits

Note that there is not yet runtime safety for this.

See #3157
This commit is contained in:
Andrew Kelley
2020-02-16 01:32:15 -05:00
parent cb3a818699
commit 7f7d1fbe5a
6 changed files with 28 additions and 10 deletions

View File

@@ -6188,7 +6188,9 @@ static LLVMValueRef ir_render_await(CodeGen *g, IrExecutableGen *executable, IrI
LLVMValueRef result_loc = (instruction->result_loc == nullptr) ?
nullptr : ir_llvm_value(g, instruction->result_loc);
if (instruction->target_fn != nullptr && !fn_is_async(instruction->target_fn)) {
if (instruction->is_noasync ||
(instruction->target_fn != nullptr && !fn_is_async(instruction->target_fn)))
{
return gen_await_early_return(g, &instruction->base, target_frame_ptr, result_type,
ptr_result_type, result_loc, true);
}