|
|
1356b61ff7
|
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>
|
2025-12-07 21:29:19 +09:00 |
|