Phase 2: Fix sema stub — add full function body type checking

- Iterate function body statements and call Sema_CheckStmt on each
- Add Sema_CheckBlock helper for child scope creation in if/while/for/loop blocks
- Extend Sema_CheckStmt to handle all statement kinds: skIf, skWhile, skDoWhile,
  skLoop, skFor, skMatch, skBreak, skContinue, skDecl, skReturn
- Extend Sema_CheckExpr with ekAssign, ekField, ekIndex, ekBlock, ekSelf
- Fix ekCall to resolve return type from function declaration
- Fix ekBinary to handle assignment operators (tkAssign, +=, -=, etc.)
- Add Sema_CollectGlobals handling for dkUse (imports), dkConst, dkEnum variants
- Add tkColonColon path parsing in parser (Color::Red)
- Add decl field to Symbol struct for function/type resolution
- Add Sema_ZeroInitSymbol helper to avoid garbage from uninitialized struct fields
- Fix concurrency.bux missing Task_Join import

All examples now pass buxc2 check. make selfhost succeeds.
This commit is contained in:
2026-06-05 14:07:38 +03:00
parent f0f94f30e1
commit 5ae85d5bd9
9 changed files with 667 additions and 20 deletions
+13
View File
@@ -413,6 +413,19 @@ func parserParsePostfix(p: *Parser) -> *Expr {
continue;
}
// Path: expr::name
if kind == tkColonColon {
discard parserAdvance(p);
let line: uint32 = parserCurToken(p).line;
let col: uint32 = parserCurToken(p).column;
let name: LexToken = parserExpect(p, tkIdent, "expected path segment");
let e: *Expr = parserMakeExpr(ekField, line, col);
e.child1 = left;
e.strValue = name.text;
left = e;
continue;
}
// as, is
if kind == tkAs || kind == tkIs {
discard parserAdvance(p);