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.
This commit is contained in:
kristopher tate 2018-07-28 14:13:26 +09:00
parent a2e5691228
commit 81f463626a

View File

@ -4154,6 +4154,7 @@ static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
executable->fn_entry->type_entry->data.fn.fn_type_id.cc == CallingConventionAsync;
if (!is_async || !executable->coro_handle) {
add_node_error(g, instruction->base.source_node, buf_sprintf("@handle() in non-async function"));
return LLVMConstNull(g->builtin_types.entry_promise->type_ref);
}
@ -6022,7 +6023,8 @@ static void do_code_gen(CodeGen *g) {
ir_render(g, fn_table_entry);
}
assert(!g->errors.length);
//assert(!g->errors.length);
if (buf_len(&g->global_asm) != 0) {
LLVMSetModuleInlineAsm(g->module, buf_ptr(&g->global_asm));