feat: Phase 8.3 async/await syntax + runtime
- AST: declFuncIsAsync flag, ekAwait expression kind - Parser: async func declarations, expr.await postfix operator - Sema: allow await anywhere (blocks current thread until task completes) - HIR: ekAwait lowered to bux_task_join(handle) call - C backend: async func emitted as regular function - Example: examples/async.bux + examples_pkg/async project - All 20 existing examples pass, selfhost build works
This commit is contained in:
@@ -118,6 +118,7 @@ type
|
||||
ekTry
|
||||
ekUnwrap ## expr! — unwrap or panic
|
||||
ekSpawn ## spawn expr — create a new task
|
||||
ekAwait ## expr.await — suspend until future resolves
|
||||
ekBlock
|
||||
ekMatch
|
||||
|
||||
@@ -200,6 +201,8 @@ type
|
||||
of ekSpawn:
|
||||
exprSpawnCallee*: Expr
|
||||
exprSpawnArgs*: seq[Expr]
|
||||
of ekAwait:
|
||||
exprAwaitOperand*: Expr
|
||||
of ekBlock:
|
||||
exprBlock*: Block
|
||||
of ekMatch:
|
||||
@@ -335,6 +338,7 @@ type
|
||||
declFuncAsm*: bool
|
||||
declFuncCallConv*: CallingConvention
|
||||
declFuncConst*: bool ## const func — evaluable at compile time
|
||||
declFuncIsAsync*: bool ## async func — returns Future<T>
|
||||
declFuncName*: string
|
||||
declFuncTypeParams*: seq[TypeParam]
|
||||
declFuncParams*: seq[Param]
|
||||
|
||||
Reference in New Issue
Block a user