smokes(self): using のドット参照を撤退し、直接ボックス名で new する形に統一(parser互換)

This commit is contained in:
nyash-codex
2025-11-01 17:25:56 +09:00
parent 1b68e903a5
commit 6ac8e80656
7 changed files with 7 additions and 7 deletions

View File

@ -12,7 +12,7 @@ test_self_param_binop() {
using "lang/src/llvm_ir/instructions/binop.hako" as BinOpInst
static box Main {
method main() {
local s = new BinOpInst.LLVMBinOpInstructionBox().lower_binop("+", 1, 2, 3)
local s = new LLVMBinOpInstructionBox().lower_binop("+", 1, 2, 3)
if s.contains("\"op\":\"binop\"") && s.contains("\"operation\":\"+\"") { print(1) } else { print(0) }
}
}

View File

@ -11,7 +11,7 @@ test_self_param_branch() {
local src='
using "lang/src/llvm_ir/instructions/branch.hako" as B
static box Main { method main() {
local s = new B.LLVMBranchInstructionBox().lower_branch(3, 1, 2)
local s = new LLVMBranchInstructionBox().lower_branch(3, 1, 2)
if s.contains("\"op\":\"branch\"") && s.contains("\"then\":1") { print(1) } else { print(0) }
} }
'

View File

@ -11,7 +11,7 @@ test_self_param_compare() {
local src='
using "lang/src/llvm_ir/instructions/compare.hako" as C
static box Main { method main() {
local s = new C.LLVMCompareInstructionBox().lower_compare("<", 1, 2, 3)
local s = new LLVMCompareInstructionBox().lower_compare("<", 1, 2, 3)
if s.contains("\"op\":\"compare\"") && s.contains("\"operation\":\"<\"") { print(1) } else { print(0) }
} }
'

View File

@ -13,7 +13,7 @@ using "lang/src/llvm_ir/instructions/const.hako" as ConstInst
static box Main {
method main() {
local v = new MapBox(); v.set("type","i64"); v.set("value",42)
local s = new ConstInst.LLVMConstInstructionBox().lower_const(1, v)
local s = new LLVMConstInstructionBox().lower_const(1, v)
if s.contains("\"op\":\"const\"") && s.contains("\"i64\"") { print(1) } else { print(0) }
}
}

View File

@ -11,7 +11,7 @@ test_self_param_jump() {
local src='
using "lang/src/llvm_ir/instructions/jump.hako" as J
static box Main { method main() {
local s = new J.LLVMJumpInstructionBox().lower_jump(5)
local s = new LLVMJumpInstructionBox().lower_jump(5)
if s.contains("\"op\":\"jump\"") && s.contains("\"target\":5") { print(1) } else { print(0) }
} }
'

View File

@ -14,7 +14,7 @@ static box Main {
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)
local phi = new LLVMPhiInstructionBox().lower_phi(5, incoming)
# 判定: 生成文字列に op":"phi が含まれるか(最小)
if phi.contains("\"op\":\"phi\"") { print(1) } else { print(0) }
}

View File

@ -11,7 +11,7 @@ test_self_param_ret() {
local src='
using "lang/src/llvm_ir/instructions/ret.hako" as R
static box Main { method main() {
local s = new R.LLVMRetInstructionBox().lower_return(7)
local s = new LLVMRetInstructionBox().lower_return(7)
if s.contains("\"op\":\"ret\"") && s.contains("\"value\":7") { print(1) } else { print(0) }
} }
'