- Add LoopFeatures struct for structure-based detection (no name deps) - Add LoopPatternKind enum and classify() function - Pattern 3: has_if_else_phi && !has_break && !has_continue - Pattern 4: has_continue == true (detection only, lowering TODO) - Unify router to use extract_features()/classify() instead of legacy - Remove AST dependency, use LoopForm/LoopScope only - Add Pattern 4 test file (loop_continue_pattern4.hako) - Pattern 3 test passes (sum=9) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
18 lines
300 B
Plaintext
18 lines
300 B
Plaintext
// Pattern 4: Loop with Continue
|
|
// Expected output: sum = 25 (1+3+5+7+9, skip even numbers)
|
|
static box Main {
|
|
main() {
|
|
local i = 0
|
|
local sum = 0
|
|
loop(i < 10) {
|
|
i = i + 1
|
|
if (i % 2 == 0) {
|
|
continue
|
|
}
|
|
sum = sum + i
|
|
}
|
|
print(sum)
|
|
return 0
|
|
}
|
|
}
|