- Extend CoreMethodId with is_pure(), allowed_in_condition(), allowed_in_init() - New MethodCallLowerer box for metadata-driven MethodCall lowering - Integrate MethodCall handling in condition_lowerer - P0: Zero-argument methods (length) supported - Design principle: NO method name hardcoding, CoreMethodId metadata only 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
26 lines
613 B
Plaintext
26 lines
613 B
Plaintext
// Phase 224-B: MethodCall lowering test - s.length() with captured variable
|
|
//
|
|
// Test case: Loop using s.length() where s is passed as parameter (captured)
|
|
// This prevents constant folding and forces MethodCall lowering
|
|
//
|
|
// Pattern 2: Loop with captured variable
|
|
|
|
static box Main {
|
|
helper(text) {
|
|
local i = 0
|
|
|
|
// Pattern 1 loop with MethodCall in condition (text is captured)
|
|
loop(i < text.length()) {
|
|
i = i + 1
|
|
}
|
|
|
|
return i
|
|
}
|
|
|
|
main() {
|
|
local result = me.helper("Hello")
|
|
print("result = " + result)
|
|
return result
|
|
}
|
|
}
|