authorgravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-07-28 14:13:26+09:00
committergravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-08-02 16:50:08+09:00
log81f463626ad09dd09e525cda140fb63baf11bc73
tree9f89ef5f7a6b5e832ce283d2b79e4b0ca19867d5
parenta2e5691228c61e5c56220fc8f5f72e47b0611000

src/codegen.cpp: add/throw error for @handle() in a non async context;

Tracking Issue #1296 ; I removed/commented-out the assert checking for no errors since we now have some errors rendered.

1 files changed, 3 insertions(+), 1 deletions(-)

src/codegen.cpp+3-1
...@@ -4154,6 +4154,7 @@ static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,...@@ -4154,6 +4154,7 @@ static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
4154 executable->fn_entry->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync;4154 executable->fn_entry->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync;
41554155
4156 if (!is_async || !executable->coro_handle) {4156 if (!is_async || !executable->coro_handle) {
4157 add_node_error(g, instruction->base.source_node, buf_sprintf("@handle() in non-async function"));
4157 return LLVMConstNull(g->builtin_types.entry_promise->type_ref);4158 return LLVMConstNull(g->builtin_types.entry_promise->type_ref);
4158 }4159 }
41594160
...@@ -6022,7 +6023,8 @@ static void do_code_gen(CodeGen *g) {...@@ -6022,7 +6023,8 @@ static void do_code_gen(CodeGen *g) {
6022 ir_render(g, fn_table_entry);6023 ir_render(g, fn_table_entry);
60236024
6024 }6025 }
6025 assert(!g->errors.length);6026
6027 //assert(!g->errors.length);
60266028
6027 if (buf_len(&g->global_asm) != 0) {6029 if (buf_len(&g->global_asm) != 0) {
6028 LLVMSetModuleInlineAsm(g->module, buf_ptr(&g->global_asm));6030 LLVMSetModuleInlineAsm(g->module, buf_ptr(&g->global_asm));