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:
+2
-2
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user