parent
2cb1f93894
commit
5a2cbe239f
|
@ -5470,7 +5470,9 @@ static LLVMValueRef ir_render_assert_non_null(CodeGen *g, IrExecutable *executab
|
|||
static LLVMValueRef ir_render_suspend_begin(CodeGen *g, IrExecutable *executable,
|
||||
IrInstructionSuspendBegin *instruction)
|
||||
{
|
||||
instruction->resume_bb = gen_suspend_begin(g, "SuspendResume");
|
||||
if (fn_is_async(g->cur_fn)) {
|
||||
instruction->resume_bb = gen_suspend_begin(g, "SuspendResume");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -7914,7 +7914,7 @@ static IrInstruction *ir_gen_suspend(IrBuilder *irb, Scope *parent_scope, AstNod
|
|||
ir_mark_gen(ir_build_check_statement_is_void(irb, child_scope, node->data.suspend.block, susp_res));
|
||||
}
|
||||
|
||||
return ir_build_suspend_finish(irb, parent_scope, node, begin);
|
||||
return ir_mark_gen(ir_build_suspend_finish(irb, parent_scope, node, begin));
|
||||
}
|
||||
|
||||
static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scope,
|
||||
|
|
|
@ -760,3 +760,17 @@ test "async call a generic function" {
|
|||
};
|
||||
_ = async S.doTheTest();
|
||||
}
|
||||
|
||||
test "return from suspend block" {
|
||||
const S = struct {
|
||||
fn doTheTest() void {
|
||||
expect(func() == 1234);
|
||||
}
|
||||
fn func() i32 {
|
||||
suspend {
|
||||
return 1234;
|
||||
}
|
||||
}
|
||||
};
|
||||
_ = async S.doTheTest();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue