feat: async functions with return values
- runtime: bux_async_return(value, size) copies result to task->result - runtime: bux_async_await returns void* result pointer - runtime: bux_async_result(handle) to retrieve result - sema: ekAwait returns *void - HIR: await lowered to bux_async_await returning *void - Example: async Compute() -> int with interleaved execution and result await
This commit is contained in:
+1
-1
@@ -770,7 +770,7 @@ proc lowerExpr(ctx: var LowerCtx, expr: Expr): HirNode =
|
||||
|
||||
of ekAwait:
|
||||
let lowered = ctx.lowerExpr(expr.exprAwaitOperand)
|
||||
return hirCall("bux_async_await", @[lowered], makeVoid(), loc)
|
||||
return hirCall("bux_async_await", @[lowered], makePointer(makeVoid()), loc)
|
||||
|
||||
else:
|
||||
return HirNode(kind: hLit, litToken: Token(kind: tkIntLiteral, text: "0", loc: loc),
|
||||
|
||||
Reference in New Issue
Block a user