Files
hakorune/tools/hako_shared
nyash-codex 608693af7f fix(json_parser): Fix infinite loop by working around MIR nested-if bug
🐛 バグ修正: JsonParserBox 無限ループ解消

**問題**:
- `vm step budget exceeded` エラーが発生
- `_parse_number()` で無限ループ

**根本原因**:
- MIR lowering の既知のバグ: ループ内のネスト if-else 文が無限ジャンプチェーンを生成
- bb11 → bb6 → bb4 の無条件ジャンプループ
- PHI 更新が実行されず、ループ変数が更新されない

**修正内容**:
1. `while` → `loop()` 構文に統一(10箇所)
2. ネスト if-else をフラット化(workaround):
   - `_parse_number()`: `ch >= "0" && ch <= "9"` → `digits.indexOf(ch) >= 0`
   - `_parse_string()`: ネスト if を分離
   - `_unescape_string()`: `ch == "\\" && i + 1 < s.length()` をフラット化

**テスト**:
- json_parser.hako: RC 0 
- ネスト if-else バグを回避して正常動作

**注記**:
- 根本修正(MIR lowering bug fix)は別タスク
- workaround で Phase 173 ブロック解除

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 17:42:57 +09:00
..