feat: async/await/spawn + fix else-if lowering bug
Self-hosted compiler (buxc2):
- Add async/await/spawn tokens, parsing, HIR, lowering, C emission
- Fix pointer type emission (*T -> T*) in C backend
- Fix sizeof(Type) parsing with parentheses
- Fix import ::{...} infinite loop guard
- Fix int64 emission by avoiding else-if chain workaround
- Add debug-free cli and hir_lower
Bootstrap compiler (Nim):
- Fix critical else-if lowering bug in hir_lower.nim:
when both elseIfs and else block exist, elseIfs were dropped
causing all else-if chains to collapse to if+else only
Runtime:
- Fix bux_async_await memory corruption (don't free in run)
- Add bux_remove_from_ready for safe cleanup
- Fix forward declaration and deduplicate bux_now_ms
Docs & examples:
- Update async.bux example with proper int64 params
- Update README, LanguageRef, Stdlib, PLAN for async features
- Mark Phase 7.10 bootstrap loop as completed
All 27 examples pass. buxc2 check/build work on all examples.
This commit is contained in:
+6
-4
@@ -832,11 +832,11 @@ proc lowerStmt(ctx: var LowerCtx, stmt: Stmt): HirNode =
|
||||
let cond = ctx.lowerExpr(stmt.stmtIfCond)
|
||||
let thenBlock = ctx.lowerBlock(stmt.stmtIfThen)
|
||||
var elseBlock: HirNode = nil
|
||||
if stmt.stmtIfElse != nil:
|
||||
elseBlock = ctx.lowerBlock(stmt.stmtIfElse)
|
||||
elif stmt.stmtIfElseIfs.len > 0:
|
||||
# Desugar else-if chain
|
||||
if stmt.stmtIfElseIfs.len > 0:
|
||||
# Desugar else-if chain, attaching else block if present
|
||||
var current: HirNode = nil
|
||||
if stmt.stmtIfElse != nil:
|
||||
current = ctx.lowerBlock(stmt.stmtIfElse)
|
||||
for i in countdown(stmt.stmtIfElseIfs.len - 1, 0):
|
||||
let elifBranch = stmt.stmtIfElseIfs[i]
|
||||
let elifCond = ctx.lowerExpr(elifBranch.cond)
|
||||
@@ -844,6 +844,8 @@ proc lowerStmt(ctx: var LowerCtx, stmt: Stmt): HirNode =
|
||||
current = HirNode(kind: hIf, ifCond: elifCond, ifThen: elifBlock,
|
||||
ifElse: current, typ: makeVoid(), loc: elifBranch.loc)
|
||||
elseBlock = current
|
||||
elif stmt.stmtIfElse != nil:
|
||||
elseBlock = ctx.lowerBlock(stmt.stmtIfElse)
|
||||
return ctx.flushPending(HirNode(kind: hIf, ifCond: cond, ifThen: thenBlock, ifElse: elseBlock,
|
||||
typ: makeVoid(), loc: loc))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user