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:
@@ -768,6 +768,10 @@ proc lowerExpr(ctx: var LowerCtx, expr: Expr): HirNode =
|
||||
return HirNode(kind: hSpawn, spawnCallee: calleeName, spawnArgs: args,
|
||||
typ: makePointer(makeVoid()), loc: loc)
|
||||
|
||||
of ekAwait:
|
||||
let lowered = ctx.lowerExpr(expr.exprAwaitOperand)
|
||||
return hirCall("bux_task_join", @[lowered], makeVoid(), loc)
|
||||
|
||||
else:
|
||||
return HirNode(kind: hLit, litToken: Token(kind: tkIntLiteral, text: "0", loc: loc),
|
||||
typ: makeVoid(), loc: loc)
|
||||
|
||||
Reference in New Issue
Block a user