Step 2完了: peek→match完全統一 + 重大PHI命令バグ発見

## 🎉 Step 2: peek→match完全統一アーキテクチャクリーンアップ完了
-  15ファイルで PeekExpr → MatchExpr 一括置換完了
-  lowering/peek.rs → match_expr.rs 完全移行
-  AI理解性・コードベース一貫性・保守性大幅向上

## 🔍 Step 3: 複数行パース問題調査完了
-  Task先生による根本原因特定完了
- 原因: オブジェクトリテラルパーサーの改行スキップ不足
- 修正: src/parser/expr/primary.rs の skip_newlines() 追加

## 🚨 重大発見: PHI命令処理バグ
- 問題: gemini_test_case.nyash で期待値2→実際0
- 原因: フェーズM+M.2のPHI統一作業でループ後変数マージに回帰バグ
- 詳細: PHI命令は正常だが、print時に間違ったPHI参照
- 影響: Phase 15セルフホスティング基盤の重大バグ

## 📝 CLAUDE.md更新
- 全進捗状況の詳細記録
- 次のアクション: ChatGPT相談でMIRビルダー修正戦略立案

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Selfhosting Dev
2025-09-23 09:00:07 +09:00
parent f469b80f0a
commit fc4c866151
27 changed files with 122 additions and 84 deletions

View File

@ -66,24 +66,27 @@ def op_boxcall(owner, fn, inst: Dict[str, Any], regs: Dict[int, Any]) -> None:
return
# User-defined box: dispatch to lowered function if available (Box.method/N)
# Skip built-in boxes (ArrayBox, MapBox, etc.) to let them fall through to their implementations
if isinstance(recv, dict) and isinstance(method, str) and "__box__" in recv:
box_name = recv.get("__box__")
cand = f"{box_name}.{method}/{len(args)}"
callee = owner.functions.get(cand)
if callee is not None:
owner._dbg(f"[pyvm] boxcall dispatch -> {cand} args={args}")
out = owner._exec_function(callee, args)
owner._set(regs, inst.get("dst"), out)
return
else:
if owner._debug:
prefix = f"{box_name}.{method}/"
cands = sorted([k for k in owner.functions.keys() if k.startswith(prefix)])
if cands:
owner._dbg(f"[pyvm] boxcall unresolved: '{cand}' — available: {cands}")
else:
any_for_box = sorted([k for k in owner.functions.keys() if k.startswith(f"{box_name}.")])
owner._dbg(f"[pyvm] boxcall unresolved: '{cand}' — no candidates; methods for {box_name}: {any_for_box}")
# Skip built-in boxes - let them fall through to built-in implementations below
if box_name not in ("ArrayBox", "MapBox", "ConsoleBox", "FileBox", "PathBox", "JsonDocBox", "JsonNodeBox"):
cand = f"{box_name}.{method}/{len(args)}"
callee = owner.functions.get(cand)
if callee is not None:
owner._dbg(f"[pyvm] boxcall dispatch -> {cand} args={args}")
out = owner._exec_function(callee, args)
owner._set(regs, inst.get("dst"), out)
return
else:
if owner._debug:
prefix = f"{box_name}.{method}/"
cands = sorted([k for k in owner.functions.keys() if k.startswith(prefix)])
if cands:
owner._dbg(f"[pyvm] boxcall unresolved: '{cand}' — available: {cands}")
else:
any_for_box = sorted([k for k in owner.functions.keys() if k.startswith(f"{box_name}.")])
owner._dbg(f"[pyvm] boxcall unresolved: '{cand}' — no candidates; methods for {box_name}: {any_for_box}")
# ConsoleBox methods
if method in ("print", "println", "log") and owner._is_console(recv):