docs(joinir): Phase 190 NumberAccumulation design (doc-only)
Design document for `result = result * 10 + digit` patterns:
- Section 1-2: Target loop analysis (_atoi, _parse_number)
- Section 3: UpdateKind::NumberAccumulation { base: i64 }
- Section 4: classify_number_update() algorithm
- Section 5: Pattern2/4 can_lower() specification
- Section 6: CarrierUpdateLowerer 2-instruction emission
- Section 7-12: Implementation roadmap, testing strategy
Key decisions:
- Safe: lhs = lhs * CONST + Variable/Const
- Unsafe: LHS 2+ occurrences, variable base, method calls
- Integer type only (no string)
- Fail-Fast for Complex patterns
Next: Phase 190-impl for code implementation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -322,6 +322,10 @@ Phase 181 で JsonParserBox 内の 11 ループを棚卸しした結果、
|
||||
- LoopUpdateAnalyzer の `UpdateKind` / `UpdateRhs` で「安全な更新パターン」を列挙し、
|
||||
そのうち string にも適用可能なものだけを **ホワイトリストで許可**する。
|
||||
- 実際の lowering は CarrierUpdateLowerer / 式 Lowerer 側で行い、JoinIR のループ形(P1–P4)は増やさない。
|
||||
3. 数値の桁展開(Phase 190 設計完了)
|
||||
- `v = v * 10 + digit` のような NumberAccumulation パターンを UpdateKind で whitelist 制御。
|
||||
- 型制約: Integer のみ許可(String は StringAppendChar 使用)。
|
||||
- 検出: AST 構造解析(名前依存禁止)、Complex パターンは Fail-Fast で reject。
|
||||
- **Phase 183 で LoopBodyLocal 役割分離完了** ✅:
|
||||
- **設計**: LoopBodyLocal を 2 カテゴリに分類:
|
||||
- **Condition LoopBodyLocal**: ループ条件(header/break/continue)で使用 → Trim 昇格対象
|
||||
|
||||
Reference in New Issue
Block a user