- Created 3 representative Pattern4 test cases: * test_pattern4_simple_continue.hako - Simple continue loop (odd number sum) * test_pattern4_parse_string.hako - String parsing with escape + continue * test_pattern4_parse_array.hako - Array element parsing with continue - Validated Pattern4_WithContinue detection: * All 3 test cases: Pattern4_WithContinue MATCHED ✅ * JoinIR lowering successful (20-24 blocks → 14-20 blocks) * [joinir/freeze] elimination: Complete (no errors on any test) - Verified execution correctness: * test_pattern4_simple_continue: Sum=25 (1+3+5+7+9) ✅ CORRECT * test_pattern4_parse_string: Execution successful, expected error handling * test_pattern4_parse_array: Execution successful, expected error handling - **MAJOR MILESTONE**: All 4 Loop Patterns Now Complete! * Pattern1 (Simple): 6 loops ✅ * Pattern2 (Break): 5 loops ✅ * Pattern3 (If-Else PHI): 1 loop ✅ * Pattern3+break (as Pattern2): 3 loops ✅ * Pattern4 (Continue): 3 loops ✅ * Total: 18 loops covered, zero [joinir/freeze] errors! - Updated CURRENT_TASK.md with Phase 165 section and complete statistics Next phases: * Phase 166: JsonParserBox full implementation & verification * Phase 167: .hako JoinIR Frontend prototype development 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
42 lines
861 B
Plaintext
42 lines
861 B
Plaintext
// Phase 165: Test simple Pattern4 (continue) loop
|
|
// Simulates: loop(i < n) { if skip { continue } process i++ }
|
|
|
|
static box Main {
|
|
main(args) {
|
|
// Simple continue pattern: skip even numbers, sum odd numbers
|
|
local i = 0
|
|
local n = 10
|
|
local sum = 0
|
|
|
|
loop(i < n) {
|
|
// Skip even numbers
|
|
local is_even = 0
|
|
if i == 0 {
|
|
is_even = 1
|
|
} else if i == 2 {
|
|
is_even = 1
|
|
} else if i == 4 {
|
|
is_even = 1
|
|
} else if i == 6 {
|
|
is_even = 1
|
|
} else if i == 8 {
|
|
is_even = 1
|
|
}
|
|
|
|
if is_even == 1 {
|
|
i = i + 1
|
|
continue
|
|
}
|
|
|
|
// Sum odd numbers
|
|
sum = sum + i
|
|
i = i + 1
|
|
}
|
|
|
|
print("Pattern4 (Simple Continue) test")
|
|
print("Sum of odd numbers 0-10: " + ("" + sum))
|
|
print("Expected: 1 + 3 + 5 + 7 + 9 = 25")
|
|
return 0
|
|
}
|
|
}
|