A案実装: debug_verify_phi_inputs呼び出し前にCFG predecessorを更新
修正箇所(7箇所):
- src/mir/builder/phi.rs:50, 73, 132, 143
- src/mir/builder/ops.rs:273, 328, 351
根本原因:
- Branch/Jump命令でsuccessorは即座に更新
- predecessorはupdate_cfg()で遅延再構築
- PHI検証が先に実行されてpredecessor未更新でpanic
解決策:
- 各debug_verify_phi_inputs呼び出し前に
if let Some(func) = self.current_function.as_mut() {
func.update_cfg();
}
を挿入してCFGを同期
影響: if/else文、論理演算子(&&/||)のPHI生成が正常動作
24 lines
695 B
Plaintext
24 lines
695 B
Plaintext
// string_ops.hako — Common string utility functions
|
|
// Responsibility: Basic string operations used across the codebase
|
|
// Non-goals: JSON parsing, complex text processing
|
|
|
|
static box StringOps {
|
|
// Find substring starting from position
|
|
// Returns: index of first occurrence at/after pos, or -1 if not found
|
|
index_of_from(text, needle, pos) {
|
|
if text == null { return -1 }
|
|
if pos < 0 { pos = 0 }
|
|
local n = text.length()
|
|
if pos >= n { return -1 }
|
|
local m = needle.length()
|
|
if m <= 0 { return pos }
|
|
local i = pos
|
|
local limit = n - m
|
|
loop (i <= limit) {
|
|
if text.substring(i, i + m) == needle { return i }
|
|
i = i + 1
|
|
}
|
|
return -1
|
|
}
|
|
}
|