🔧 Hotfix 7 (Enhanced): ValueId receiver alias tracking for nested loops

- Problem: Pinned receiver variables in loops cause undefined ValueId errors
- Enhanced fix: Update all receiver aliases (me + all __pin$N$@recv levels)
- Handles nested loops by updating previous pin levels
- Test status: Partial improvement, ValueId(50) → ValueId(40)
- Further investigation needed for complete fix

Files modified:
- src/mir/phi_core/loopform_builder.rs (emit_header_phis)
This commit is contained in:
nyash-codex
2025-11-19 00:02:41 +09:00
parent 263affe379
commit 80f8a7bc8c
17 changed files with 983 additions and 277 deletions

View File

@ -12,10 +12,12 @@ static box FuncScannerBox {
return me._scan_methods(source, box_name, 1, 0)
}
// Scan all static box definitions and collect their methods.
method scan_all_boxes(source) {
local defs = new ArrayBox()
local s = "" + source
// Scan all static box definitions and collect their methods.
method scan_all_boxes(source) {
// source が null の場合はスキャン対象がないので空配列を返すよ。
if source == null { return new ArrayBox() }
local defs = new ArrayBox()
local s = "" + source
local n = s.length()
local i = 0
local in_str = 0
@ -377,9 +379,11 @@ static box FuncScannerBox {
return params
}
// Helper: strip comments from source
method _strip_comments(source) {
local s = "" + source
// Helper: strip comments from source
method _strip_comments(source) {
// source が null の場合はそのまま空文字として扱う(コメント除去する対象がないだけ)
if source == null { return "" }
local s = "" + source
local out = ""
local i = 0
local n = s.length()