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:
@@ -170,6 +170,7 @@ func Cli_Check(srcPath: String) -> int {
|
||||
PrintLine("Parse failed");
|
||||
return 1;
|
||||
}
|
||||
PrintLine(" Parse done");
|
||||
|
||||
// Flatten module wrappers
|
||||
var decl2: *Decl = mod.firstItem;
|
||||
@@ -185,6 +186,14 @@ func Cli_Check(srcPath: String) -> int {
|
||||
let sema: *Sema = Sema_Analyze(mod);
|
||||
if Sema_HasError(sema) {
|
||||
PrintLine("Sema errors found");
|
||||
var i: int = 0;
|
||||
while i < Sema_DiagCount(sema) {
|
||||
Print(" line ");
|
||||
PrintInt(sema.diags[i].line as int64);
|
||||
Print(": ");
|
||||
PrintLine(sema.diags[i].message);
|
||||
i = i + 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user