feat(joinir): Phase 183 LoopBodyLocal role separation + test fixes
Phase 183 Implementation: - Added is_var_used_in_condition() helper for AST variable detection - Implemented LoopBodyLocal filtering in TrimLoopLowerer - Created 4 test files for P1/P2 patterns - Added 5 unit tests for variable detection Test Fixes: - Fixed test_is_outer_scope_variable_pinned (BasicBlockId import) - Fixed test_pattern2_accepts_loop_param_only (literal node usage) Refactoring: - Unified pattern detection documentation - Consolidated CarrierInfo initialization - Documented LoopScopeShape construction paths 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -294,6 +294,12 @@ Phase 181 で JsonParserBox 内の 11 ループを棚卸しした結果、
|
||||
2. 文字列連結フィルタ(Phase 178)
|
||||
- `num_str = num_str + ch` のような string concat を保守的に reject
|
||||
- JsonParser では必須の操作なので段階的に有効化が必要
|
||||
- **設計原則**:
|
||||
- string は「特別扱いのパターン」ではなく、あくまで MirType の 1 種類として扱う。
|
||||
- Pattern2/4 側で型名や変数名(`"result"`, `"num_str"` など)に依存した分岐は入れない。
|
||||
- LoopUpdateAnalyzer の `UpdateKind` / `UpdateRhs` で「安全な更新パターン」を列挙し、
|
||||
そのうち string にも適用可能なものだけを **ホワイトリストで許可**する。
|
||||
- 実際の lowering は CarrierUpdateLowerer / 式 Lowerer 側で行い、JoinIR のループ形(P1–P4)は増やさない。
|
||||
- **Phase 183 で LoopBodyLocal 役割分離完了** ✅:
|
||||
- **設計**: LoopBodyLocal を 2 カテゴリに分類:
|
||||
- **Condition LoopBodyLocal**: ループ条件(header/break/continue)で使用 → Trim 昇格対象
|
||||
|
||||
Reference in New Issue
Block a user