Phase 185: Body-local Pattern2/4 integration skeleton - Added collect_body_local_variables() helper - Integrated UpdateEnv usage in loop_with_break_minimal - Test files created (blocked by init lowering) Phase 186: Body-local init lowering infrastructure - Created LoopBodyLocalInitLowerer box (378 lines) - Supports BinOp (+/-/*//) + Const + Variable - Fail-Fast for method calls/string operations - 3 unit tests passing Phase 187: String UpdateLowering design (doc-only) - Defined UpdateKind whitelist (6 categories) - StringAppendChar/Literal patterns identified - 3-layer architecture documented - No code changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
808 B
Plaintext
28 lines
808 B
Plaintext
// Phase 185: Minimal JsonParser-style loop with body-local integer calculation
|
|
// Tests Pattern2 integration with LoopBodyLocalEnv
|
|
|
|
static box Main {
|
|
main() {
|
|
local sum = 0
|
|
local pos = 0
|
|
local start = 0
|
|
local end = 5
|
|
|
|
// Pattern2: break loop with body-local digit_pos
|
|
loop(pos < end) {
|
|
local digit_pos = pos - start // Body-local calculation
|
|
sum = sum * 10
|
|
sum = sum + digit_pos // Use body-local in update
|
|
pos = pos + 1
|
|
|
|
if (sum > 50) {
|
|
break // Break condition
|
|
}
|
|
}
|
|
|
|
print(sum) // Expected: 0*10+0 → 0*10+1 → 1*10+2 → 12*10+3 → 123 → break
|
|
// Output: 123 (breaks before digit_pos=4)
|
|
return 0
|
|
}
|
|
}
|