feat(joinir): Phase 224-B - MethodCallLowerer + CoreMethodId extension

- Extend CoreMethodId with is_pure(), allowed_in_condition(), allowed_in_init()
- New MethodCallLowerer box for metadata-driven MethodCall lowering
- Integrate MethodCall handling in condition_lowerer
- P0: Zero-argument methods (length) supported
- Design principle: NO method name hardcoding, CoreMethodId metadata only

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-10 17:59:24 +09:00
parent 4cddca1cae
commit 250555bfc0
8 changed files with 881 additions and 0 deletions

View File

@ -296,6 +296,21 @@ Local Region (1000+):
- PatternPipelineContext.is_if_sum_pattern() で条件複雑度をチェック。
- P3 if-sum mode は単純比較のみ受理、複雑条件は PoC lowerer へフォールバック。
- **MethodCallLowererPhase 224-B 実装完了)**
- ファイル: `src/mir/join_ir/lowering/method_call_lowerer.rs`
- 責務:
- AST MethodCall ノードを JoinIR BoxCall に loweringメタデータ駆動
- CoreMethodId の `is_pure()`, `allowed_in_condition()`, `allowed_in_init()` でホワイトリスト判定。
- Phase 224-B P0: 引数なしメソッドのみ対応(`s.length()`, `arr.length()` 等)。
- 設計原則:
- **メソッド名ハードコード禁止**: CoreMethodId メタデータのみ参照。
- **Fail-Fast**: ホワイトリストにないメソッドは即座にエラー。
- **Box-First**: 単一責任("このMethodCallをJoinIRにできるか")だけを担当。
- 使用箇所:
- `condition_lowerer.rs` の `lower_value_expression()` から呼び出し。
- Pattern 2/3/4 のループ条件式で `s.length()` 等をサポート可能。
- 次ステップ: Phase 224-C で引数付きメソッド(`substring(i, i+1)`, `indexOf(ch)`)対応予定。
- **LoopBodyCarrierPromoterPhase 171-C-2 実装済み)**
- ファイル: `src/mir/loop_pattern_detection/loop_body_carrier_promoter.rs`
- 責務: