diff --git a/src/cli.bux b/src/cli.bux index 033d2f5..ee7e5b7 100644 --- a/src/cli.bux +++ b/src/cli.bux @@ -232,6 +232,8 @@ func Cli_Check(srcPath: String) -> int { while i < Sema_DiagCount(sema) { Print(" line "); PrintInt(sema.diags[i].line as int64); + Print(" col "); + PrintInt(sema.diags[i].column as int64); Print(": "); PrintLine(sema.diags[i].message); i = i + 1; @@ -656,6 +658,8 @@ func Cli_BuildProject(projectDir: String) -> int { while i < Sema_DiagCount(sema) { Print(" line "); PrintInt(sema.diags[i].line as int64); + Print(" col "); + PrintInt(sema.diags[i].column as int64); Print(": "); PrintLine(sema.diags[i].message); i = i + 1; diff --git a/src/sema.bux b/src/sema.bux index 1c51fea..569ec9b 100644 --- a/src/sema.bux +++ b/src/sema.bux @@ -2,6 +2,9 @@ // Validates types, resolves identifiers, checks function calls. module Sema { +extern func Print(s: String); +extern func PrintLine(s: String); + // --------------------------------------------------------------------------- // Sema context // --------------------------------------------------------------------------- @@ -127,15 +130,14 @@ func Sema_TypeName(kind: int) -> String { func Sema_CheckBlock(sema: *Sema, block: *Block) { if block == null as *Block { return; } - var blockScope: Scope = Scope_NewChild(sema.scope); - let prevScope: *Scope = sema.scope; - sema.scope = &blockScope; + // Use current scope directly — only function bodies create new scopes. + // This matches Nim bootstrap behavior and fixes variable visibility + // in nested blocks (if/while bodies). var stmt: *Stmt = block.firstStmt; while stmt != null as *Stmt { Sema_CheckStmt(sema, stmt); stmt = stmt.nextStmt; } - sema.scope = prevScope; } // ---------------------------------------------------------------------------