# Two-phase refactor — slice 12 (nested modules) Branch `ast-stage-c`. Suite **178/178**; self-hosting fixpoint **OK** (**3,034,200 bytes**; slice 11 was 3,032,308). ## What landed `NestedModule` now builds an `NkUnit(name, decls, body, imports)` using its own local import accumulator (`nImp`/`nImpTail`), and sets `astDecl` to that node — so the enclosing `DeclSeq` records the nested module as a declaration. A local accumulator keeps the enclosing unit's imports (`astImp`) intact. ## Verified (temporary `AST.Dump`, then removed) ```modula2 MODULE nestdump; VAR x : INTEGER; MODULE Inner; VAR y : INTEGER; BEGIN y := 5 END Inner; BEGIN x := 1 END nestdump. ``` gave the outer `NkUnit(nestdump, decls=[NkVarDecl x, NkUnit(Inner, decls=[NkVarDecl y], body=[y:=5])], body=[x:=1])`. ## Still not covered - **`CLASS` / `CLASS IMPLEMENTATION`** items. Note: the compiler's own sources contain **no** actual class declarations (only the word in comments and the scanner's keyword table), so this is not needed for self-hosting validation — it is a user-facing OOP feature and a sizeable slice of its own. - `Lower` + `.ssa` byte-compare. - `MaxChild` cap on `CASE` arms / `WITH` designators / call actuals. ## Next `CLASS` (if desired) or the `Lower` walk.