feat(joinir): Task 200-2 - JoinInlineBoundaryBuilder implementation for Pattern2

Builder pattern for JoinInlineBoundary construction, reduces field manipulation scattering.

# Changes
- NEW: src/mir/join_ir/lowering/inline_boundary_builder.rs (165 lines)
  - JoinInlineBoundaryBuilder with 7 fluent methods
  - Complete unit test coverage (4 tests)
- MODIFIED: src/mir/join_ir/lowering/mod.rs (+2 lines)
  - Export inline_boundary_builder module
  - Public re-export of JoinInlineBoundaryBuilder
- MODIFIED: src/mir/builder/control_flow/joinir/patterns/pattern2_with_break.rs
  - Replace direct boundary field manipulation with builder pattern
  - 9 lines of field assignments → fluent builder chain

# Benefits
- **Centralized**: All boundary construction logic in builder
- **Readable**: Fluent API shows construction intent clearly
- **Maintainable**: Changes to boundary structure isolated to builder
- **Type Safe**: Builder validates field consistency

# Tests
 All builder unit tests pass (4/4)
 All pattern module tests pass (30+)
 Library build succeeds with no errors

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-08 04:25:58 +09:00
parent 3571a97458
commit 3645a3c2d2
4 changed files with 262 additions and 10 deletions

View File

@ -157,7 +157,49 @@ loop (i < n) {
---
## 5. 関連ドキュメント
## 5. Pattern × Box マトリクスPhase 200 追加)
各 Pattern がどの Box を使うかを一覧にしたよ。
これで Claude / ChatGPT / 将来の自分が「このパターンはどの箱を使うか」をすぐ把握できる。
| Box / Module | P1 Minimal | P2 Break | P3 IfPHI | P4 Continue | P5 Trimlike* |
|--------------------------------------|------------|----------|-----------|-------------|---------------|
| **ConditionEnv** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **BoolExprLowerer** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **LoopConditionScopeBox** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **LoopScopeShapeBuilder** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **ConditionEnvBuilder** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **LoopHeaderPhiBuilder** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **ExitMeta / ExitMetaCollector** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **ExitLine / ExitLineReconnector** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **JoinInlineBoundary** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **BreakConditionAnalyzer** | ❌ | ✅ | ❌ | ❌ | ✅ |
| **Pattern4CarrierAnalyzer** | ❌ | ❌ | ❌ | ✅ | ❌ |
| **ContinueBranchNormalizer** | ❌ | ❌ | ❌ | ✅ | ❌ |
| **LoopUpdateAnalyzer** | ❌ | ❌ | ❌ | ✅ | ❌ |
| **LoopBodyCarrierPromoter** | ❌ | ❌ | ❌ | ❌ | ✅ |
| **TrimLoopHelper** | ❌ | ❌ | ❌ | ❌ | ✅ |
| **TrimPatternValidator** | ❌ | ❌ | ❌ | ❌ | ✅ |
| **TrimPatternLowerer** | ❌ | ❌ | ❌ | ❌ | ✅ |
| **BlockAllocator** (merge) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **ValueCollector** (merge) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **InstructionRewriter** (merge) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **ExitPhiBuilder** (merge) | ✅ | ✅ | ✅ | ✅ | ✅ |
**凡例**:
- ✅: 使用する(必須)
- ❌: 使用しない
- 🔮: 将来的に使用予定(設計段階)
**備考**:
- P5 (Trimlike) は Phase 171172 で validation + JoinIR lowering まで完了。
- P6〜P12break+continue 同時、複数キャリア、matchPHI など)は将来パターンとして識別済み。
- すべての Pattern は **LoopConditionScopeBox** で条件変数のスコープを分類するFailFast の要)。
- **TrimLoopHelper / TrimPatternValidator / TrimPatternLowerer** は P5 専用(他パターンには影響しない)。
---
## 6. 関連ドキュメント
- `joinir-architecture-overview.md`
JoinIR 全体の箱と契約。Loop/If/ExitLine/Boundary/条件式ラインの全体図。