🎯 箱理論の実践: 単一責務の箱を作る ## 箱化内容 ✅ CalleeGuardBox(約150行、テスト込み約200行) - 責務: 構造ガード専任(静的Box/ランタイムBox混線防止) - 状態: value_typesのみ保持(最小化) - ピュア関数的: Callee入力 → 検証・変換 → Callee出力 ## 実装 - src/mir/builder/calls/guard.rs: 新ファイル - CalleeGuardBox::apply_static_runtime_guard() - CalleeGuardBox::is_me_call() - CalleeGuardBox::get_box_type() - 単体テスト3件追加(me-call検出、正規化) - src/mir/builder/calls/emit.rs: 箱化移行 - emit_unified_call_impl内でCalleeGuardBox使用 - 古いapply_static_runtime_guardメソッド削除(約50行削減) - src/mir/builder/calls/mod.rs: モジュール追加 - pub mod guard;(Phase 25.1d完了マーク) ## 箱理論原則 ✅ 箱にする: 構造ガード機能を1箱に集約 ✅ 境界を作る: MirBuilderから分離、独立した責務 ✅ 戻せる: 独立箱なので切り離し・差し替え可能 ✅ テスト容易: 単体テスト3件で検証済み ## 効果 - コード整理: emit.rs 約50行削減 - 保守性向上: 構造ガードロジックが1ファイルに集約 - テスト品質: 単体テストで挙動保証 - 拡張容易: 将来の構造ガード追加が容易 ## テスト結果 - ✅ CalleeGuardBox単体テスト 3件パス - ✅ 既存テスト mir_stageb_like系 パス - ✅ ビルド成功(0エラー) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
MIR Builder — Calls SSOT
Scope
- This directory is the single source of truth for call shaping in the builder.
- Responsibilities: target resolution, extern mapping, method lookup, flags/effects, MIR emission.
Out of scope
- Runtime dispatch details (VM/LLVM) and legacy by-name resolution. The VM keeps a legacy resolver only behind a dev flag for bring-up.
Contract
- Builder must populate
MirInstruction::Callwith a concreteCalleewhenever possible. - Arity and canonical names are normalized here so runtimes can be simple routers.
Phase-3 alignment
- VM call resolver is treated as legacy-only. Default runtime disables by-name fallback.
- Extern interface normalization aligns with
handlers/calls/externs.rs(runtime SSOT for extern dispatch).