From the Inside Claude Code - The Claude Code Ecosystem architecture map

The Lowerer is one struct spread over 38 files and 29,700 lines with no unit tests

risk · high · verified

A single Lowerer type has impl blocks in 38 of the 43 files under src/ir/lowering, about 29,700 lines and roughly 680 functions, sharing 27 fields of mutable state (globals, function metadata, type caches, sema maps). The repo's own cleanup backlog lists it as item 7, and global_init.rs is flagged for 16 levels of nesting. None of these files contains a #[test].

Impact: Any change to lowering can touch shared state used by expression, statement, global-initializer and type code at once, and regressions surface only when a whole C program is compiled.

Recommendation (large effort): Carve the Lowerer into owned sub-components with narrow interfaces (type mapping, global initializers, expression lowering) that take explicit context instead of &mut self, and add focused unit tests for each, beginning with types.rs and global_init*.rs whose inputs are pure data.

The trail

  1. IR Lowering
  2. Lowerer
  3. Operators and Assignment
  4. Compound Global Init
  5. Types
Open on the map

More from this board