selfhost: expand Decl to 256 fields, fix unary precedence, add discard/var parsing, fix diag buffer overflow

- ast.bux: Decl expanded with field0..field255, variant0..7, param0..8
- parser.bux: add parserParseUnary for correct unary precedence; handle tkDiscard statements; allow var without initializer (matching bootstrap); add diagCount bounds check in parserEmitDiag
- hir.bux: HirParam changed to pointers
- hir_lower.bux: full field chains for struct lowering
- c_backend.bux: hardened -> vs . field access; null checks in CBE_GetExprTypeName
- cli.bux: add -lcrypto to linker
This commit is contained in:
2026-06-07 14:58:23 +03:00
parent 0bdef58182
commit 3b4456f01f
7 changed files with 1254 additions and 105 deletions
+10 -2
View File
@@ -318,7 +318,11 @@ func Sema_CheckStmt(sema: *Sema, stmt: *Stmt) {
sym.typeKind = initType;
sym.typeName = "";
if stmt.refStmtType != null as *TypeExpr {
sym.typeName = stmt.refStmtType.typeName;
if stmt.refStmtType.kind == tekPointer && stmt.refStmtType.pointerPointee != null as *TypeExpr {
sym.typeName = String_Concat(stmt.refStmtType.pointerPointee.typeName, "*");
} else {
sym.typeName = stmt.refStmtType.typeName;
}
}
sym.isMutable = stmt.boolValue;
sym.isPublic = false;
@@ -695,7 +699,11 @@ func Sema_Analyze(mod: *Module) -> *Sema {
pSym.kind = skVar;
if p != null as *Param && p.refParamType != null as *TypeExpr {
pSym.typeKind = Sema_ResolveType(s, p.refParamType);
pSym.typeName = p.refParamType.typeName;
if p.refParamType.kind == tekPointer && p.refParamType.pointerPointee != null as *TypeExpr {
pSym.typeName = String_Concat(p.refParamType.pointerPointee.typeName, "*");
} else {
pSym.typeName = p.refParamType.typeName;
}
} else {
pSym.typeKind = tyInt;
pSym.typeName = "";