feat(joinir): Phase 170-D-impl-1 LoopConditionScopeBox skeleton creation
Implement the LoopConditionScope analysis infrastructure for Pattern2/4 validation: New module: - src/mir/loop_pattern_detection/loop_condition_scope.rs (220 lines) Types: - CondVarScope enum: LoopParam, OuterLocal, LoopBodyLocal - CondVarInfo: Variable name + scope classification - LoopConditionScope: Collection of analyzed variables with helper methods Box implementation (LoopConditionScopeBox): - analyze(): Main entry point - extracts and classifies condition variables - extract_vars(): Recursive AST traversal to find all variable references - is_outer_local(): Heuristic for outer scope detection (phase 170-D simplified) Helper methods: - has_loop_body_local(): Check for unsupported loop-body variables - all_in(): Validate scope compatibility - var_names(): Get variable set - add_var(): Add with deduplication Tests: 5 unit tests for core functionality Architecture: Refactored loop_pattern_detection.rs → loop_pattern_detection/mod.rs for modular organization. Build: ✅ Passed with no errors 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -91,6 +91,13 @@ JoinIR ラインで守るべきルールを先に書いておくよ:
|
||||
- `ConditionEnv` 経由で「変数名 → JoinIR ValueId」のみを見る。
|
||||
- host 側の ValueId は `ConditionBinding { name, host_value, join_value }` として JoinInlineBoundary に記録する。
|
||||
|
||||
- **LoopConditionScopeBox(設計中)**
|
||||
- 予定ファイル: `src/mir/loop_pattern_detection/loop_condition_scope.rs` 等
|
||||
- 責務:
|
||||
- 条件式に登場する変数が、ループパラメータ(LoopParam)/ループ外ローカル(OuterLocal)/ループ本体ローカル(LoopBodyLocal)のどれかを分類する。
|
||||
- Pattern2/4 が「対応してよい条件のスコープ」を判定するための箱。
|
||||
- ループ本体ローカルを条件に含む高度なパターンは、将来の Pattern5+ で扱う設計とし、現状は Fail‑Fast で明示的に弾く。
|
||||
|
||||
### 2.3 キャリア / Exit / Boundary ライン
|
||||
|
||||
- **CarrierInfo / LoopUpdateAnalyzer**
|
||||
|
||||
Reference in New Issue
Block a user