smokes(self): Hakoコードを static box Main { method main() } 形式に統一(parser互換)

This commit is contained in:
nyash-codex
2025-11-01 17:24:45 +09:00
parent 26040be0d8
commit 1b68e903a5
7 changed files with 10 additions and 10 deletions

View File

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

View File

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

View File

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

View File

@ -10,8 +10,8 @@ preflight_plugins || exit 2
test_self_param_const() {
local src='
using "lang/src/llvm_ir/instructions/const.hako" as ConstInst
box Main {
static method main() {
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)
if s.contains("\"op\":\"const\"") && s.contains("\"i64\"") { print(1) } else { print(0) }

View File

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

View File

@ -10,8 +10,8 @@ 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() {
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)

View File

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