feat(joinir): Phase 224-B - MethodCallLowerer + CoreMethodId extension

- 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>
This commit is contained in:
nyash-codex
2025-12-10 17:59:24 +09:00
parent 4cddca1cae
commit 250555bfc0
8 changed files with 881 additions and 0 deletions

View File

@ -0,0 +1,25 @@
// 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
}
}

View File

@ -0,0 +1,22 @@
// Phase 224-B: MethodCall lowering test - s.length() in loop condition
//
// Test case: Simple loop using s.length() in condition
// Expected: MethodCall should be lowered to BoxCall instruction
//
// Pattern 1: Simple while loop (no break, no continue)
static box Main {
main() {
local s = "Hello"
local i = 0
// Pattern 1 loop with MethodCall in condition
loop(i < s.length()) {
i = i + 1
}
// Output result
print("i = " + i)
return i
}
}