mirror of
https://github.com/ziglang/zig.git
synced 2026-01-10 09:25:11 +00:00
src/codegen.cpp: remove add_node_error from ir_render_handle;
Tracking Issue #1296 ; Thanks @andrewrk ;
This commit is contained in:
parent
81f463626a
commit
0ee6502562
@ -4149,17 +4149,7 @@ static LLVMValueRef ir_render_frame_address(CodeGen *g, IrExecutable *executable
|
||||
static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
|
||||
IrInstructionHandle *instruction)
|
||||
{
|
||||
|
||||
bool is_async = executable->fn_entry != nullptr &&
|
||||
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);
|
||||
}
|
||||
|
||||
LLVMValueRef handle = ir_llvm_value(g, executable->coro_handle);
|
||||
return LLVMBuildRet(g->builder, handle);
|
||||
return LLVMConstNull(g->builtin_types.entry_promise->type_ref);
|
||||
}
|
||||
|
||||
static LLVMValueRef render_shl_with_overflow(CodeGen *g, IrInstructionOverflowOp *instruction) {
|
||||
|
||||
@ -57,6 +57,9 @@ test "coroutine suspend with block" {
|
||||
resume a_promise;
|
||||
std.debug.assert(result);
|
||||
cancel p;
|
||||
|
||||
assert( @handle() );
|
||||
|
||||
}
|
||||
|
||||
var a_promise: promise = undefined;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user