nyash-codex
b6e31cf8ca
feat(joinir): Phase 184 - Body-local MIR Lowering Infrastructure
Phase 184 implements the foundation for body-local variable support in
update expressions, completing the three-box architecture:
LoopBodyLocalEnv (storage), UpdateEnv (composition), and
CarrierUpdateEmitter (emission).
## Implementation Summary
### Task 184-1: Design Document
- Created phase184-body-local-mir-lowering.md
- Two-Environment System design (ConditionEnv + LoopBodyLocalEnv)
- Box-First design principles documented
### Task 184-2: LoopBodyLocalEnv Implementation
- New file: src/mir/join_ir/lowering/loop_body_local_env.rs (216 lines)
- Storage box for body-local variable name → ValueId mappings
- BTreeMap for deterministic ordering (PHI consistency)
- 7 unit tests: empty env, single/multiple locals, get/contains, iteration
### Task 184-3: UpdateEnv Implementation
- New file: src/mir/join_ir/lowering/update_env.rs (237 lines)
- Composition box for unified variable resolution
- Priority order: ConditionEnv (condition vars) → LoopBodyLocalEnv (body-local)
- 8 unit tests: priority, fallback, not found, combined lookup
### Task 184-4: CarrierUpdateEmitter Integration
- Modified: src/mir/join_ir/lowering/carrier_update_emitter.rs
- Added emit_carrier_update_with_env() (UpdateEnv version)
- Kept emit_carrier_update() for backward compatibility
- 4 new unit tests: body-local variable, priority, not found, const update
- Total 10 tests PASS (6 existing + 4 new)
### Task 184-5: Representative Test Cases
- apps/tests/phase184_body_local_update.hako (Pattern1 baseline)
- apps/tests/phase184_body_local_with_break.hako (Pattern2, Phase 185 target)
### Task 184-6: Documentation Updates
- Updated: docs/development/current/main/joinir-architecture-overview.md
- Updated: CURRENT_TASK.md (Phase 184 completion record)
## Test Results
All 25 unit tests PASS:
- LoopBodyLocalEnv: 7 tests
- UpdateEnv: 8 tests
- CarrierUpdateEmitter: 10 tests (6 existing + 4 new)
Build: ✅ Success (0 errors)
## Design Constraints
Following 箱理論 (Box Theory) principles:
- Single Responsibility: Each box has one clear purpose
- Deterministic: BTreeMap ensures consistent ordering
- Conservative: Pattern5 (Trim) integration deferred to Phase 185
- Fail-Fast: Explicit errors for unsupported patterns
## Scope Limitation
Phase 184 provides the **infrastructure only**:
- ✅ Storage box (LoopBodyLocalEnv)
- ✅ Composition box (UpdateEnv)
- ✅ Emission support (CarrierUpdateEmitter)
- ❌ Pattern2/4 integration (requires body-local collection, Phase 185)
## Next Steps
Phase 185: Pattern2/4 Integration
- Integrate LoopBodyLocalEnv into Pattern2/4 lowerers
- Add body-local variable collection from loop body AST
- Enable full E2E body-local variable support in update expressions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-08 23:59:19 +09:00
..
2025-12-03 13:42:05 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 01:45:03 +09:00
2025-09-17 10:58:12 +09:00
2025-12-04 10:52:10 +09:00
2025-12-05 16:08:56 +09:00
2025-12-04 06:02:03 +09:00
2025-12-04 06:02:03 +09:00
2025-12-03 13:59:06 +09:00
2025-12-05 23:33:06 +09:00
2025-12-05 23:33:06 +09:00
2025-12-08 04:14:28 +09:00
2025-12-02 21:52:18 +09:00
2025-12-04 15:00:45 +09:00
2025-12-04 06:02:03 +09:00
2025-12-08 23:59:19 +09:00
2025-12-08 06:14:03 +09:00
2025-12-08 00:09:45 +09:00
2025-12-03 14:33:04 +09:00
2025-12-06 16:22:38 +09:00
2025-12-08 18:36:13 +09:00
2025-12-04 17:47:19 +09:00
2025-12-06 03:30:03 +09:00
2025-12-06 03:30:03 +09:00
2025-11-27 17:05:46 +09:00
2025-12-05 14:41:24 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-08 00:09:45 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-11-29 15:57:14 +09:00
2025-11-29 15:57:14 +09:00
2025-11-29 15:57:14 +09:00
2025-11-30 08:54:18 +09:00
2025-12-02 09:45:54 +09:00
2025-11-30 10:10:45 +09:00
2025-12-02 10:19:07 +09:00
2025-12-02 11:16:01 +09:00
2025-12-02 12:36:28 +09:00
2025-12-02 19:37:01 +09:00
2025-12-02 19:37:01 +09:00
2025-12-02 19:37:01 +09:00
2025-12-02 19:37:01 +09:00
2025-12-02 20:18:13 +09:00
2025-12-02 20:18:13 +09:00
2025-12-02 20:18:13 +09:00
2025-12-02 20:30:22 +09:00
2025-12-02 20:18:13 +09:00
2025-12-02 19:37:01 +09:00
2025-12-02 19:37:01 +09:00
2025-12-02 21:09:15 +09:00
2025-12-02 21:09:15 +09:00
2025-12-03 18:16:49 +09:00
2025-12-03 19:37:32 +09:00
2025-12-03 19:37:32 +09:00
2025-12-03 19:22:55 +09:00
2025-12-03 21:32:14 +09:00
2025-12-03 21:12:37 +09:00
2025-12-03 22:03:16 +09:00
2025-12-04 03:35:25 +09:00
2025-12-04 03:58:02 +09:00
2025-12-04 04:30:30 +09:00
2025-12-04 04:30:30 +09:00
2025-12-04 04:42:32 +09:00
2025-12-04 06:26:59 +09:00
2025-12-04 04:42:32 +09:00
2025-12-04 04:42:32 +09:00
2025-12-04 06:02:03 +09:00
2025-12-04 06:02:03 +09:00
2025-12-04 06:02:03 +09:00
2025-12-04 06:17:10 +09:00
2025-12-04 06:24:03 +09:00
2025-12-04 06:02:03 +09:00
2025-12-04 06:02:03 +09:00
2025-12-04 06:02:03 +09:00
2025-12-04 11:04:29 +09:00
2025-12-04 10:57:13 +09:00
2025-12-04 11:28:55 +09:00
2025-12-04 11:44:55 +09:00
2025-12-04 12:06:34 +09:00
2025-12-04 12:22:55 +09:00
2025-12-04 12:27:44 +09:00
2025-12-04 13:07:12 +09:00
2025-12-04 13:07:12 +09:00
2025-12-04 13:33:44 +09:00
2025-12-04 13:54:45 +09:00
2025-12-04 14:10:51 +09:00
2025-12-04 14:19:48 +09:00
2025-12-04 15:15:27 +09:00
2025-12-04 15:00:45 +09:00
2025-12-04 15:00:45 +09:00
2025-12-04 15:00:45 +09:00
2025-12-04 15:23:43 +09:00
2025-12-04 16:16:56 +09:00
2025-12-04 19:37:18 +09:00
2025-12-04 19:34:19 +09:00
2025-12-06 16:22:38 +09:00
2025-12-04 19:38:06 +09:00
2025-12-04 19:37:18 +09:00
2025-12-05 23:26:55 +09:00
2025-12-05 23:26:55 +09:00
2025-12-07 23:09:25 +09:00
2025-12-07 01:45:03 +09:00
2025-12-07 01:45:03 +09:00
2025-12-04 16:16:56 +09:00
2025-12-07 14:17:58 +09:00
2025-12-07 23:09:25 +09:00
2025-12-07 23:09:25 +09:00
2025-12-07 23:09:25 +09:00
2025-12-07 23:09:25 +09:00
2025-12-07 21:29:19 +09:00
2025-12-07 01:45:03 +09:00
2025-12-04 16:55:11 +09:00
2025-12-07 01:45:03 +09:00
2025-12-04 17:03:14 +09:00
2025-12-07 01:45:03 +09:00
2025-12-07 01:45:03 +09:00
2025-12-07 01:45:03 +09:00
2025-12-08 02:41:53 +09:00
2025-12-04 16:35:34 +09:00
2025-12-04 16:55:11 +09:00
2025-12-08 03:06:20 +09:00
2025-12-04 17:47:19 +09:00
2025-12-04 17:47:19 +09:00
2025-12-04 17:47:19 +09:00
2025-12-04 17:47:19 +09:00
2025-12-04 18:20:07 +09:00
2025-12-04 18:20:07 +09:00
2025-12-04 18:20:07 +09:00
2025-12-04 17:47:19 +09:00
2025-12-08 10:13:34 +09:00
2025-12-08 10:13:34 +09:00
2025-12-08 10:13:34 +09:00
2025-12-04 19:34:19 +09:00
2025-12-08 13:08:44 +09:00
2025-12-08 13:08:44 +09:00
2025-12-08 15:17:53 +09:00
2025-12-08 15:17:53 +09:00
2025-12-08 15:17:53 +09:00
2025-12-08 15:17:53 +09:00
2025-12-08 16:34:04 +09:00
2025-12-08 16:34:04 +09:00
2025-12-08 18:36:13 +09:00
2025-12-08 19:29:10 +09:00
2025-12-08 21:09:00 +09:00
2025-12-08 21:19:54 +09:00
2025-12-08 21:26:57 +09:00
2025-12-08 21:42:51 +09:00
2025-12-08 21:34:16 +09:00
2025-12-08 23:14:10 +09:00
2025-12-08 21:26:57 +09:00
2025-12-08 23:59:19 +09:00
2025-12-05 16:05:32 +09:00
2025-12-06 03:30:03 +09:00
2025-12-06 11:09:52 +09:00
2025-12-06 11:09:03 +09:00
2025-12-06 16:22:38 +09:00
2025-12-06 14:46:33 +09:00
2025-12-06 14:46:33 +09:00
2025-12-07 21:02:20 +09:00
2025-12-07 21:02:20 +09:00
2025-12-05 16:06:39 +09:00
2025-12-06 11:10:38 +09:00
2025-11-23 05:53:27 +09:00
2025-12-07 21:02:20 +09:00
2025-12-04 03:58:02 +09:00
2025-12-04 12:40:01 +09:00
2025-11-21 07:00:05 +09:00
2025-11-21 08:03:03 +09:00
2025-11-21 08:03:03 +09:00
2025-12-08 15:17:53 +09:00
2025-11-20 17:10:03 +09:00
2025-11-20 17:10:03 +09:00
2025-11-20 17:10:03 +09:00