zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 81f463626ad09dd09e525cda140fb63baf11bc73 (tree)
parent a2e5691228c61e5c56220fc8f5f72e47b0611000
Author: kristopher tate <kt@connectfree.co.jp>
Date:   Sat, 28 Jul 2018 14:13:26 +0900

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.

Diffstat:
Msrc/codegen.cpp | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/codegen.cpp b/src/codegen.cpp @@ -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));