refactor(mir): Phase 25.1o - do_break/continue 共通化(LoopExitKind型統一)

【変更内容】
1. LoopExitKind enum定義
   - Break / Continue の型安全な区別

2. do_loop_exit() 共通メソッド作成(47行)
   - スナップショット取得(共通処理)
   - kind別のスナップショット保存
   - kind別のジャンプターゲット
   - unreachable ブロック切り替え(共通処理)

3. do_break/continue をthin wrapperに変換
   - do_break: 13行 → 4行
   - do_continue: 12行 → 4行
   - 合計21行削減

【効果】
- 構造改善: break/continue の共通ロジック一箇所に集約
- 保守性向上: デバッグログなどの共通処理が統一管理
- 拡張性向上: labeled break/continue等の将来拡張が容易

【検証結果】
- ビルド成功(警告なし)
- mir_stageb_loop_break_continue_verifies: PASS
- /tmp/loop_continue_fixed.hako: RC=3(期待通り)

関連: Phase 25.1m (continue PHI修正), Phase 25.1n (レガシー削除)
This commit is contained in:
nyash-codex
2025-11-19 08:56:44 +09:00
parent 77fc670cd3
commit 75f3df2505
11 changed files with 92 additions and 89 deletions

View File

@ -98,7 +98,9 @@ The .hako implementation in this directory is **architecturally correct** but op
- `HAKO_LOOPSSA_EXIT_PHI=1`: Enable .hako EXIT PHI (disabled by default)
- `HAKO_COMPILER_BUILDER_TRACE=1`: Show compilation pass trace
- `NYASH_LOOPFORM_DEBUG=1`: Debug Rust loopform builder
- `NYASH_LOOPFORM_PHI_V2=1`: Enable Rust EXIT PHI generation
- `NYASH_LOOPFORM_PHI_V2`:
- 以前は Rust 側 LoopForm PHI v2 の切り替えフラグだったが、
- 現在は **LoopForm PHI v2 が常に既定実装**のため、設定不要(存在しても挙動は変わらない)。
## File Sizes