Files
hakorune/apps/tests/phase269_p0_pattern8_frag_min.hako
tomoaki 5f22fe8fcd feat(pattern8): Phase 269 P1 - SSA fix and call_method type annotation
Phase 269 P1.0: Pattern8 SSA correctness
- Add PHI node for loop variable `i` in pattern8_scan_bool_predicate.rs
- Ensure proper SSA form: i_current = phi [(preheader, i_init), (step, i_next)]
- Create loop_predicate_scan.rs for Pattern8 Frag emission
- Pre-allocate PHI destination before block generation
- Use insert_phi_at_head_spanned() for span synchronization

Phase 269 P1.1: call_method return type SSOT propagation
- Add callee_sig_name() helper in annotation.rs for function name formatting
- Annotate call_method return types in emit_unified_call_impl()
- Use module signature as SSOT for return type resolution (no hardcoding)
- Arity-aware function name: "BoxName.method/arity"

Fixes: is_integer() now correctly returns Bool instead of String
Test: Simple call_method test returns exit=7 (loop test has pre-existing bug)
Unit tests: All 1389 tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-22 01:41:19 +09:00

36 lines
770 B
Plaintext

static box StringUtils {
is_digit(ch) {
return ch == "0" or ch == "1" or ch == "2" or ch == "3" or ch == "4"
or ch == "5" or ch == "6" or ch == "7" or ch == "8" or ch == "9"
}
is_integer(s) {
if s.length() == 0 {
return false
}
local start = 0
if s.substring(0, 1) == "-" {
if s.length() == 1 {
return false
}
start = 1
}
local i = start
loop(i < s.length()) {
if not this.is_digit(s.substring(i, i + 1)) {
return false
}
i = i + 1
}
return true
}
}
static box Main {
main() {
return StringUtils.is_integer("123") ? 7 : 1
}
}