llvm(phis): 静的Box self 先頭規約を phi に段階導入し、自己検証スモークを追加\n\n- lang/src/llvm_ir/instructions/phi.hako: lower_* 群に self を追加(呼び出し側はインスタンス経由で互換)\n- smokes: quick/core/phi/self_param_phi_vm.sh で JSON 生成を確認

This commit is contained in:
nyash-codex
2025-11-01 17:01:14 +09:00
parent 36dbba4aa1
commit e86151e20f
2 changed files with 42 additions and 13 deletions

View File

@ -0,0 +1,29 @@
#!/bin/bash
# Verify LLVMPhiInstructionBox.lower_phi requires self (implicit receiver) and returns JSON
source "$(dirname "$0")/../../../lib/test_runner.sh"
source "$(dirname "$0")/../../../lib/result_checker.sh"
require_env || exit 2
preflight_plugins || exit 2
test_self_param_phi() {
local src='
using "lang/src/llvm_ir/instructions/phi.hako" as PhiInst
box Main {
static method main() {
local incoming = new ArrayBox()
local item = new MapBox(); item.set("value", 1); item.set("block", 0); incoming.push(item)
local phi = new PhiInst.LLVMPhiInstructionBox().lower_phi(5, incoming)
# 判定: 生成文字列に op":"phi が含まれるか(最小)
if phi.contains("\"op\":\"phi\"") { print(1) } else { print(0) }
}
}
'
local out
out=$(run_nyash_vm -c "$src" 2>&1)
check_exact "1" "$out" "self_param_phi"
}
run_test "self_param_phi" test_self_param_phi