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
+2
View File
@@ -18,6 +18,7 @@ struct Symbol {
typeName: String;
isMutable: bool;
isPublic: bool;
decl: *Decl; // associated declaration (for funcs, structs, enums)
}
struct Scope {
@@ -90,4 +91,5 @@ func Scope_LookupLocal(scope: *Scope, name: String) -> Symbol {
func Scope_Free(scope: *Scope) {
bux_free(scope.symbols as *void);
}
}