aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-02-25 17:34:05 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-02-25 17:34:05 -0500
commit83f89064490350991806aea02ea6ba4b948c0376 (patch)
tree974070d5e0d3cd4251a699de9476b60e57502ce7 /src/ir.cpp
parent4eac75914bcdf9648518d1837f48e07e35744dc1 (diff)
downloadzig-83f89064490350991806aea02ea6ba4b948c0376.tar.gz
zig-83f89064490350991806aea02ea6ba4b948c0376.zip
codegen for coro_resume instruction
See #727
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 5ab2b149d6..81bde2e793 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -6143,14 +6143,19 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec
ir_set_cursor_at_end_and_append_block(irb, end_free_block);
IrBasicBlock *resume_block = ir_create_basic_block(irb, scope, "Resume");
- ir_build_cond_br(irb, scope, node, resume_awaiter, resume_block, suspend_block, const_bool_false);
+ IrBasicBlock *return_block = ir_create_basic_block(irb, scope, "Return");
+ ir_build_cond_br(irb, scope, node, resume_awaiter, resume_block, return_block, const_bool_false);
ir_set_cursor_at_end_and_append_block(irb, resume_block);
IrInstruction *unwrapped_await_handle_ptr = ir_build_unwrap_maybe(irb, scope, node,
irb->exec->coro_awaiter_field_ptr, false);
IrInstruction *awaiter_handle = ir_build_load_ptr(irb, scope, node, unwrapped_await_handle_ptr);
ir_build_coro_resume(irb, scope, node, awaiter_handle);
- ir_build_br(irb, scope, node, suspend_block, const_bool_false);
+ ir_build_br(irb, scope, node, return_block, const_bool_false);
+
+ ir_set_cursor_at_end_and_append_block(irb, return_block);
+ IrInstruction *undef = ir_build_const_undefined(irb, scope, node);
+ ir_build_return(irb, scope, node, undef);
}
return true;