From 522742e9df7fc5ac596ce4aa53d41b31e4f6a030 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 16 Oct 2026 09:46:18 +0000 Subject: refactor(codegen): separate type checks from designator access Co-Authored-By: Claude Fable 5.1 --- AGENTS/ARCH.md | 2 +- AGENTS/SUBSYSTEMS.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'AGENTS') diff --git a/AGENTS/ARCH.md b/AGENTS/ARCH.md index a8813e9..663ed40 100644 --- a/AGENTS/ARCH.md +++ b/AGENTS/ARCH.md @@ -268,7 +268,7 @@ do not modify the real release for local verification. | `lib/CodeGen/CodeGen.cc` | Initialization, symbols, call arguments and main() compilation | | `lib/CodeGen/ExpressionGen.cc`, `StatementGen.cc`, `ControlFlowGen.cc` | Expression/statement dispatch and control-flow emission | | `lib/CodeGen/ValueTypeGen.cc`, `OutputGen.cc`, `Builtins.h` | Expression typing, coercion/declarations, scalar output and the shared builtin table | -| `lib/CodeGen/Designator.cc` | CodeGen methods for the TYPE system: type pre-pass, `emitLValue`/`loadFromLValue`, `emitCoercedExpr` gate, user-kind binary-op interception | +| `lib/CodeGen/Designator.cc`, `TypeCheckGen.cc` | TYPE pre-pass and lvalue access; type admission and user-kind binary operators | | `lib/CodeGen/CTypeGen.cc` | CodeGen methods for native C scalar conversions, casts, arithmetic and input/output | | `lib/CodeGen/NativeTypeSystem.cc` | Builtin registration, native C type imports/aliases and scalar promotion | | `lib/CodeGen/FileHandler.cc`, `FileRuntimeIO.cc` | File runtime setup/lookup/open and call entry points; read/write/close/EOF helper bodies | diff --git a/AGENTS/SUBSYSTEMS.md b/AGENTS/SUBSYSTEMS.md index d1ae721..f693b1c 100644 --- a/AGENTS/SUBSYSTEMS.md +++ b/AGENTS/SUBSYSTEMS.md @@ -38,7 +38,9 @@ compile error (no extern is fabricated). Body emission is inverted: CodeGen inje `StmtEmitter` callback, and must restore its own insert point (and the exchanged ArrayTable) afterwards. -**User types** (`TypeSystem` + `Designator.cc`): TYPE declarations are top-level only +**User types** (`TypeSystem` + `Designator.cc` + `TypeCheckGen.cc`): +`Designator.cc` owns the type pre-pass and lvalue access; `TypeCheckGen.cc` owns +type admission and user-kind binary operators. TYPE declarations are top-level only and registered by `CodeGen::runTypePrePass` in two passes — `declareUserType` reserves every name (records become opaque named structs, so pointer pointees may forward-reference: `TYPE NodePtr = ^Node` before `TYPE Node`), then -- cgit v1.3.1-4-g156e