fix(mir): Phase 25.1m - Continue PHI修正 & Bug A main(args)ループ修正

**Phase 25.1m: Continue PHI修正**
- seal_phis に continue_snapshots 入力を追加 (loopform_builder.rs)
- LoopShape::debug_validate に continue/break エッジ検証追加 (control_form.rs)
- test_seal_phis_includes_continue_snapshots テスト追加
- 実証テスト成功: balanced scan loop で 228回イテレーション確認

**Bug A修正: main(args) でループ未実行問題**
- LoopBuilder::build_loop で entry → preheader への jump 追加
- decls.rs でデュアル関数作成時のブロック接続修正
- mir_static_main_args_loop.rs テスト追加

**パーサー改善**:
- parser_box.hako に HAKO_PARSER_PROG_MAX ガード追加(無限ループ対策)

🎉 成果:
- Continue 文の PHI predecessor mismatch エラー完全解消
- main(args) パラメータ有りループが正常動作
- Stage-B balanced scan で continue 正常動作確認 (228回イテレーション)

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-19 08:04:43 +09:00
parent b086933acb
commit a95fedf26a
10 changed files with 547 additions and 42 deletions

View File

@ -152,11 +152,17 @@ impl super::MirBuilder {
let scope_id = self.current_block.map(|bb| bb.as_u32()).unwrap_or(0);
self.hint_scope_enter(scope_id);
let mut last_value = None;
for statement in statements {
let total = statements.len();
eprintln!("[DEBUG/build_block] Processing {} statements", total);
for (idx, statement) in statements.into_iter().enumerate() {
eprintln!("[DEBUG/build_block] Statement {}/{} current_block={:?} current_function={}",
idx+1, total, self.current_block,
self.current_function.as_ref().map(|f| f.signature.name.as_str()).unwrap_or("none"));
last_value = Some(self.build_statement(statement)?);
// If the current block was terminated by this statement (e.g., return/throw),
// do not emit any further instructions for this block.
if is_current_block_terminated(self)? {
eprintln!("[DEBUG/build_block] Block terminated after statement {}", idx+1);
break;
}
}
@ -168,6 +174,7 @@ impl super::MirBuilder {
if !self.is_current_block_terminated() {
self.hint_scope_leave(scope_id);
}
eprintln!("[DEBUG/build_block] Completed, returning value {:?}", out);
Ok(out)
}