Box theory refactoring: Extract exit_bindings construction logic from
pattern lowerers into focused, reusable ExitMetaCollector Box.
**Changes**:
1. Created meta_collector.rs (+102 lines):
- ExitMetaCollector::collect() builds exit_bindings from ExitMeta
- Pure function (no side effects)
- Reusable by all pattern lowerers
2. Updated pattern2_with_break.rs (-20 lines):
- Use ExitMetaCollector::collect() instead of inline filter_map
- Removed manual binding construction loop
- Cleaner caller code
3. Made exit_line module public:
- Allows pattern lowerers to use ExitMetaCollector
- Clear module visibility boundaries
**Box Design**:
- Single responsibility: Convert ExitMeta + variable_map → exit_bindings
- Pure function: No side effects, testable independently
- Reusable: Can be used by Pattern 3, Pattern 4, etc.
**Testing**:
- Build: ✅ Success (1m 04s)
- Execution: ✅ RC: 0 (Pattern 2 verified)
- Regression: ✅ No issues
**Metrics**:
- New lines: +102 (meta_collector.rs)
- Removed lines: -20 (pattern2_with_break.rs)
- Net change: +82 lines
- Code clarity: Significantly improved
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Proper HOST↔JoinIR ValueId separation for condition variables:
- Add ConditionEnv struct (name → JoinIR-local ValueId mapping)
- Add ConditionBinding struct (HOST/JoinIR ValueId pairs)
- Modify condition_to_joinir to use ConditionEnv instead of builder.variable_map
- Update Pattern2 lowerer to build ConditionEnv and ConditionBindings
- Extend JoinInlineBoundary with condition_bindings field
- Update BoundaryInjector to inject Copy instructions for condition variables
This fixes the undefined ValueId errors where HOST ValueIds were being
used directly in JoinIR instructions. Programs now execute (RC: 0),
though loop variable exit values still need Phase 172 work.
Key invariants established:
1. JoinIR uses ONLY JoinIR-local ValueIds
2. HOST↔JoinIR bridging is ONLY through JoinInlineBoundary
3. condition_to_joinir NEVER accesses builder.variable_map
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>