Files
hakorune/src/mir/loop_pattern_detection
tomoaki 09b968256f feat(normalization): Phase 253 - mutable_accumulator_analyzer detector pattern
**Core Change**: Refactor from "validator" to "detector" pattern

**Before** (Fail-Fast):
- Err for non-accumulator assignments (i = i - 1, i = s.length(), etc.)
- JoinIR pipeline aborted on detection

**After** (Detector):
- Ok(None) for non-accumulator patterns (other lowering paths can handle)
- Only Add operator supported (i = i + 1)
- Other operators/patterns return None gracefully

**Modified Behavior** (6 locations):
1. L112-116: operator != Add → Ok(None)
2. L149-152: RHS MethodCall/Call → Ok(None)
3. L153-156: RHS complex expression → Ok(None)
4. L158-161: Left operand reversed → Ok(None)
5. L162-165: Left operand not Variable → Ok(None)
6. L166-170: Value not BinaryOp → Ok(None)

**Tests** (11/11 PASS):
- 2 existing tests updated (Err → Ok(None))
- 3 new tests added:
  - test_decrement_not_accumulator (i = i - 1)
  - test_complex_rhs_not_accumulator (x = x + (i + 1))
  - test_non_binop_assignment_not_accumulator (i = s.length())

**Documentation**:
- Updated docstring to reflect detector strategy
- Detection Strategy section added with all Ok(None) cases

**Status**:
-  mutable-acc-spec errors eliminated
- ⚠️ quick profile still FAIL: StringUtils.index_of/2 not JoinIR-supported (Phase 254 scope)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-19 20:38:57 +09:00
..