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:
2026-06-01 01:13:48 +03:00
parent 5ec755743d
commit 42041dfd74
4 changed files with 48 additions and 22 deletions
+2 -2
View File
@@ -1010,8 +1010,8 @@ proc checkExpr(sema: var Sema, expr: Expr, scope: Scope): Type =
return makePointer(makeVoid())
of ekAwait:
let operand = sema.checkExpr(expr.exprAwaitOperand, scope)
# await on a task handle returns void for now
return makeVoid()
# await on a task handle returns *void (result pointer)
return makePointer(makeVoid())
of ekSpread:
return sema.checkExpr(expr.exprSpreadOperand, scope)