blaise/docs
Graeme Geldenhuys b5726091be feat(units): support classes declared in a unit implementation section
A class (or record-with-methods) declared in a unit's `implementation`
section is now fully supported: its methods are accepted, its bodies are
type-checked, and its type metadata (typeinfo, vtable, _FieldCleanup) is
emitted on both backends so the unit links and runs.

Three layered problems, fixed together:

1. Semantic ordering + body analysis (uSemantic.AnalyseUnitForExport):
   impl-section TYPE decls are registered before LinkClassMethodImpls (so an
   impl-section class has its methods in FMethodGroups), and ImplBlock method
   bodies are now analysed alongside IntfBlock ones (otherwise field/param
   references carried no ResolvedType and codegen aborted).

2. Codegen emission: native EmitUnit and QBE AppendUnit walked only
   IntfBlock.TypeDecls.  They now emit ImplBlock classes too — method bodies,
   class section (typeinfo/vtable/_FieldCleanup) and interface defs — under the
   owning unit's mangling prefix.  Each backend establishes the emitted unit as
   the symbol-table viewing context so the impl-private class resolves during
   emission and the reference/definition symbol names agree.

3. Cross-unit leak (the blocker): impl-section symbols were registered in the
   shared global scope and leaked into unrelated units via TSymbolTable.Lookup's
   flat-table fallback — a class in unit A's implementation section resolved
   inside an unrelated unit B that never `uses` A (and self-built the compiler
   into a SIGSEGV).  Impl-section symbols are now tagged IsImplPrivate and
   Lookup suppresses them whenever the viewing unit is not the owner.  Interface
   symbols and transitive interface-uses visibility are unchanged.

This also closes the corresponding latent leak: an implementation-section
declaration of any unit no longer resolves in units that do not use it.

Tests: cp.test.e2e.sepcompile gains TestNativeImplSectionClass_Compiles,
TestQBEImplSectionClass_Compiles, and TestImplSectionClass_DoesNotLeakCrossUnit.
Rationale recorded in docs/language-rationale.adoc.

All four fixpoints (QBE, native, internal-asm, warm-cache) green; full suite
3859 tests on both the QBE-built and native-built test runner.
2026-06-27 17:40:08 +01:00
..
benchmark.txt docs(benchmark): add QBE 1.3 measurement entry 2026-06-02 17:17:54 +01:00
bif-format.adoc docs: .bif file format reference 2026-06-03 19:40:08 +01:00
design.adoc refactor: rename uCodeGen/uCodeGenQBE to blaise.codegen/blaise.codegen.qbe 2026-06-10 12:12:14 +01:00
extending-ast.adoc refactor: rename uCodeGen/uCodeGenQBE to blaise.codegen/blaise.codegen.qbe 2026-06-10 12:12:14 +01:00
freebsd-x86_64-backend-design.adoc feat(rtl): FreeBSD freestanding _start + minimal syscall leaf (Step 3) 2026-06-26 23:58:08 +01:00
future-improvements.adoc feat(stdlib): add Numerics.Money — currency-aware TMoney 2026-06-20 10:33:35 +01:00
grammar.ebnf feat(parser): require parentheses on inherited calls; fix metaclass diagnostic 2026-06-25 13:36:27 +01:00
inline-asm-design.adoc feat(lang): inline assembler blocks (asm … end routine bodies) 2026-06-25 01:01:41 +01:00
internal-linker-design.adoc docs: mark internal linker Phases C and D as implemented 2026-06-19 10:51:09 +01:00
language-rationale.adoc feat(units): support classes declared in a unit implementation section 2026-06-27 17:40:08 +01:00
name-mangling.adoc refactor: rename uCodeGen/uCodeGenQBE to blaise.codegen/blaise.codegen.qbe 2026-06-10 12:12:14 +01:00
native-const-arg-arc-port.adoc docs: native const-arg ARC port design — mark implemented 2026-06-11 07:36:13 +01:00
native-target-architecture.adoc docs: RTL unification plan — one binary, embedded source, no external .a 2026-06-25 23:08:30 +01:00
rtl-unification-plan.adoc docs: RTL-unification implementation plan 2026-06-25 23:08:30 +01:00
self-contained-start-design.adoc fix(linker): ship own _start; drop system CRT startup objects (#142) 2026-06-24 23:39:11 +01:00
testing-strategy.adoc refactor: rename uCodeGen/uCodeGenQBE to blaise.codegen/blaise.codegen.qbe 2026-06-10 12:12:14 +01:00