first steps to defining specialised slot classes

getting rid of the mess in SlotDefinition (wip)
This commit is contained in:
2020-02-10 18:12:39 +07:00
parent df4fd409c1
commit 24d7fe25da
35 changed files with 104 additions and 62 deletions

View File

@ -3,7 +3,7 @@ require_relative "helper"
module SlotMachine
class TestArgumentTransfer < SlotMachineInstructionTest
def instruction
receiver = SlotDefinition.new(:message , [:receiver])
receiver = MessageDefinition.new( [:receiver])
arg = SlotLoad.new("test", [:message, :caller] , [:message,:type] )
ArgumentTransfer.new("" , receiver ,[arg])
end

View File

@ -3,7 +3,7 @@ require_relative "helper"
module SlotMachine
class TestNotSameCheck < SlotMachineInstructionTest
def instruction
target = SlotDefinition.new(:message , :caller)
target = SlotDefinition.for(:message , :caller)
NotSameCheck.new(target , target , Label.new("ok" , "target"))
end
def test_len

View File

@ -4,7 +4,7 @@ module SlotMachine
class TestSlotDefinitionBasics < MiniTest::Test
def slot(slot = :caller)
SlotDefinition.new(:message , slot)
MessageDefinition.new(slot)
end
def test_create_ok1
assert_equal :message , slot.known_object

View File

@ -6,7 +6,7 @@ module SlotMachine
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = Risc::FakeCompiler.new
@definition = SlotDefinition.new(StringConstant.new("hi") , [])
@definition = SlotDefinition.for(StringConstant.new("hi") , [])
@register = @definition.to_register(@compiler , InstructionMock.new)
@instruction = @compiler.instructions.first
end
@ -27,7 +27,7 @@ module SlotMachine
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = Risc::FakeCompiler.new
@definition = SlotDefinition.new(StringConstant.new("hi") , [:type])
@definition = SlotDefinition.for(StringConstant.new("hi") , [:type])
@register = @definition.to_register(@compiler , InstructionMock.new)
@instruction = @compiler.instructions.first
end

View File

@ -5,7 +5,7 @@ module SlotMachine
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = Risc::FakeCompiler.new
@definition = SlotDefinition.new(:message , :caller)
@definition = MessageDefinition.new( :caller)
@register = @definition.to_register(@compiler , "fake source")
@instruction = @compiler.instructions.first
end

View File

@ -5,7 +5,7 @@ module SlotMachine
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = Risc::FakeCompiler.new
@definition = SlotDefinition.new(:message , [:caller , :type])
@definition = MessageDefinition.new( [:caller , :type])
@register = @definition.to_register(@compiler , InstructionMock.new)
end
def test_def_next_class

View File

@ -3,7 +3,7 @@ require_relative "helper"
module SlotMachine
class TestSameCheck < SlotMachineInstructionTest
def instruction
target = SlotDefinition.new(:message , :caller)
target = MessageDefinition.new( :caller)
TruthCheck.new(target , Label.new("ok" , "target"))
end
def test_len