diff --git a/home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb b/home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/risc/instructions/load_constant.rb b/lib/risc/instructions/load_constant.rb index 4a043c6e..572d10fa 100644 --- a/lib/risc/instructions/load_constant.rb +++ b/lib/risc/instructions/load_constant.rb @@ -9,7 +9,7 @@ module Risc super(source) @register = register @constant = constant - raise "Not Constant #{constant}" if constant.is_a?(SlotMachine::SlotDefinition) + raise "Not Constant #{constant}" if constant.is_a?(SlotMachine::Slot) raise "Not register #{register}" unless RegisterValue.look_like_reg(register) end attr_accessor :register , :constant diff --git a/lib/slot_language/slot_maker.rb b/lib/slot_language/slot_maker.rb index c922c4f1..98da64de 100644 --- a/lib/slot_language/slot_maker.rb +++ b/lib/slot_language/slot_maker.rb @@ -18,7 +18,7 @@ module SlotLanguage end def slot_def(compiler) - SlotMachine::SlotDefinition.for(:message , leaps) + SlotMachine::Slot.for(:message , leaps) end def to_s diff --git a/lib/slot_machine/instruction/argument_transfer.rb b/lib/slot_machine/instruction/argument_transfer.rb index 68575cbc..5d8bd478 100644 --- a/lib/slot_machine/instruction/argument_transfer.rb +++ b/lib/slot_machine/instruction/argument_transfer.rb @@ -25,7 +25,7 @@ module SlotMachine def initialize( source , receiver,arguments ) super(source) @receiver , @arguments = receiver , arguments - raise "Receiver not SlotDefinition #{@receiver}" unless @receiver.is_a?(SlotDefinition) + raise "Receiver not Slot #{@receiver}" unless @receiver.is_a?(Slot) @arguments.each{|a| raise "args not SlotLoad #{a}" unless a.is_a?(SlotLoad)} end diff --git a/lib/slot_machine/instruction/constant_definition.rb b/lib/slot_machine/instruction/constant_slot.rb similarity index 87% rename from lib/slot_machine/instruction/constant_definition.rb rename to lib/slot_machine/instruction/constant_slot.rb index 3fb4c3c2..e6e7da11 100644 --- a/lib/slot_machine/instruction/constant_definition.rb +++ b/lib/slot_machine/instruction/constant_slot.rb @@ -1,14 +1,14 @@ module SlotMachine - class ConstantDefinition < SlotDefinition + class ConstantSlot < Slot # get the right definition, depending on the object def self.for(object , slots) case object when :message - MessageDefinition.new(slots) + MessageSlot.new(slots) when Constant - ConstantDefinition.new(object , slots) + ConstantSlot.new(object , slots) else - SlotDefinition.new(object,slots) + Slot.new(object,slots) end end diff --git a/lib/slot_machine/instruction/message_definition.rb b/lib/slot_machine/instruction/message_slot.rb similarity index 97% rename from lib/slot_machine/instruction/message_definition.rb rename to lib/slot_machine/instruction/message_slot.rb index cc6f12e0..b83e9428 100644 --- a/lib/slot_machine/instruction/message_definition.rb +++ b/lib/slot_machine/instruction/message_slot.rb @@ -1,5 +1,5 @@ module SlotMachine - class MessageDefinition < SlotDefinition + class MessageSlot < Slot def initialize(slots) super(:message , slots) diff --git a/lib/slot_machine/instruction/not_same_check.rb b/lib/slot_machine/instruction/not_same_check.rb index c2cca3f4..d967a501 100644 --- a/lib/slot_machine/instruction/not_same_check.rb +++ b/lib/slot_machine/instruction/not_same_check.rb @@ -3,7 +3,7 @@ module SlotMachine # SlotMachine internal check, as the name says to see if two values are not the same # In other words, we this checks identity, bit-values, pointers # - # The values that are compared are defined as SlotDefinitions, ie can be anything + # The values that are compared are defined as Slots, ie can be anything # available to the machine through frame message or self # # Acording to SlotMachine::Check logic, we jump to the given label is the values are the same diff --git a/lib/slot_machine/instruction/object_definition.rb b/lib/slot_machine/instruction/object_slot.rb similarity index 97% rename from lib/slot_machine/instruction/object_definition.rb rename to lib/slot_machine/instruction/object_slot.rb index 99a47369..8e652106 100644 --- a/lib/slot_machine/instruction/object_definition.rb +++ b/lib/slot_machine/instruction/object_slot.rb @@ -1,5 +1,5 @@ module SlotMachine - class ObjectDefinition < SlotDefinition + class ObjectSlot < Slot def initialize( object , slots) super(object , slots ) diff --git a/lib/slot_machine/instruction/slot_definition.rb b/lib/slot_machine/instruction/slot.rb similarity index 83% rename from lib/slot_machine/instruction/slot_definition.rb rename to lib/slot_machine/instruction/slot.rb index dab66bb5..d8536d6e 100644 --- a/lib/slot_machine/instruction/slot_definition.rb +++ b/lib/slot_machine/instruction/slot.rb @@ -1,11 +1,11 @@ module SlotMachine - # A SlotDefinition defines a slot. A bit like a variable name but for objects. + # A Slot defines a slot. A bit like a variable name but for objects. # # PS: for the interested: A "development" of Smalltalk was the # prototype based language (read: JavaScript equivalent) # called Self https://en.wikipedia.org/wiki/Self_(programming_language) # - # SlotDefinitions are the instance names of objects. But since the language is dynamic + # Slots are the instance names of objects. But since the language is dynamic # what is it that we can say about instance names at runtime? # Start with a known object like the Message (in register one), we know all it's # variables. But there is a Message in there, and for that we know the instances @@ -14,16 +14,16 @@ module SlotMachine # The definiion is an array of symbols that we can resolve to SlotLoad # Instructions. Or in the case of constants to ConstantLoad # - class SlotDefinition + class Slot # get the right definition, depending on the object def self.for(object , slots) case object when :message - MessageDefinition.new(slots) + MessageSlot.new(slots) when Constant - ConstantDefinition.new(object , slots) + ConstantSlot.new(object , slots) when Parfait::Object , Risc::Label - ObjectDefinition.new(object , slots) + ObjectSlot.new(object , slots) else raise "not supported type #{object}" end diff --git a/lib/slot_machine/instruction/slot_load.rb b/lib/slot_machine/instruction/slot_load.rb index 9b804570..8734c3ac 100644 --- a/lib/slot_machine/instruction/slot_load.rb +++ b/lib/slot_machine/instruction/slot_load.rb @@ -4,9 +4,9 @@ module SlotMachine # A Slot is basically an instance variable, but it must be of known type # # The value loaded (the right hand side) can be a constant (SlotMachine::Constant) or come from - # another Slot (SlotDefinition) + # another Slot (Slot) # - # The Slot on the left hand side is always a SlotDefinition. + # The Slot on the left hand side is always a Slot. # The only known object (*) for the left side is the current message, which is a bit like # the oo version of a Stack (Stack Register, Frame Pointer, ..) # (* off course all class objects are global, and so they are allowed too) @@ -18,10 +18,10 @@ module SlotMachine # From the outside a send is neccessary, both for get and set, (which goes through the method # resolution and guarantees the correct method for a type), in other words perfect data hiding. # - # @left: A SlotDefinition, or an array that can be passed to the constructor of the - # SlotDefinition (see there) + # @left: A Slot, or an array that can be passed to the constructor of the + # Slot (see there) # - # @right: A SlotDefinition with slots or a SlotMachine::Constant + # @right: A Slot with slots or a SlotMachine::Constant # original_source: optinally another slot_machine instruction that will be passed down # to created risc instructions. (Because SlotLoad is often used internally) class SlotLoad < Instruction @@ -31,10 +31,10 @@ module SlotMachine def initialize(source , left , right, original_source = nil) super(source) @left , @right = left , right - @left = SlotDefinition.for(@left.shift , @left) if @left.is_a? Array - @right = SlotDefinition.for(@right.shift , @right) if @right.is_a? Array - raise "right not SlotMachine, #{@right.to_s}" unless @right.is_a?( SlotDefinition ) - raise "left not SlotMachine, #{@left.to_s}" unless @left.is_a?( SlotDefinition ) + @left = Slot.for(@left.shift , @left) if @left.is_a? Array + @right = Slot.for(@right.shift , @right) if @right.is_a? Array + raise "right not SlotMachine, #{@right.to_s}" unless @right.is_a?( Slot ) + raise "left not SlotMachine, #{@left.to_s}" unless @left.is_a?( Slot ) @original_source = original_source || self end @@ -54,7 +54,7 @@ module SlotMachine end end -require_relative "slot_definition" -require_relative "message_definition" -require_relative "constant_definition" -require_relative "object_definition" +require_relative "slot" +require_relative "message_slot" +require_relative "constant_slot" +require_relative "object_slot" diff --git a/lib/slot_machine/instruction/truth_check.rb b/lib/slot_machine/instruction/truth_check.rb index c2bac6b0..f3cdcfa2 100644 --- a/lib/slot_machine/instruction/truth_check.rb +++ b/lib/slot_machine/instruction/truth_check.rb @@ -11,7 +11,7 @@ module SlotMachine def initialize(condition , false_jump) super(false_jump) @condition = condition - raise "condition must be slot_definition #{condition}" unless condition.is_a?(SlotDefinition) + raise "condition must be slot_definition #{condition}" unless condition.is_a?(Slot) end def to_s diff --git a/lib/sol/assignment.rb b/lib/sol/assignment.rb index 7bb706ea..afc6c7d5 100644 --- a/lib/sol/assignment.rb +++ b/lib/sol/assignment.rb @@ -32,7 +32,7 @@ module Sol # # Derived classes do not implement to_slot, only slot_position def to_slot(compiler) - to = SlotMachine::SlotDefinition.for(:message , self.slot_position(compiler)) + to = SlotMachine::Slot.for(:message , self.slot_position(compiler)) from = @value.to_slot_definition(compiler) assign = SlotMachine::SlotLoad.new(self,to,from) return assign unless @value.is_a?(CallStatement) diff --git a/lib/sol/basic_values.rb b/lib/sol/basic_values.rb index 08f3f0bb..7d3c92e2 100644 --- a/lib/sol/basic_values.rb +++ b/lib/sol/basic_values.rb @@ -10,7 +10,7 @@ module Sol @value = value end def to_slot_definition(_) - return SlotMachine::SlotDefinition.for(SlotMachine::IntegerConstant.new(@value) , []) + return SlotMachine::Slot.for(SlotMachine::IntegerConstant.new(@value) , []) end def ct_type Parfait.object_space.get_type_by_class_name(:Integer) @@ -38,7 +38,7 @@ module Sol Parfait.object_space.get_type_by_class_name(:True) end def to_slot_definition(_) - return SlotMachine::SlotDefinition.for(Parfait.object_space.true_object , []) + return SlotMachine::Slot.for(Parfait.object_space.true_object , []) end def to_s(depth = 0) "true" @@ -50,7 +50,7 @@ module Sol Parfait.object_space.get_type_by_class_name(:False) end def to_slot_definition(_) - return SlotMachine::SlotDefinition.for(Parfait.object_space.false_object , []) + return SlotMachine::Slot.for(Parfait.object_space.false_object , []) end def to_s(depth = 0) "false" @@ -62,7 +62,7 @@ module Sol Parfait.object_space.get_type_by_class_name(:Nil) end def to_slot_definition(_) - return SlotMachine::SlotDefinition.for(Parfait.object_space.nil_object , []) + return SlotMachine::Slot.for(Parfait.object_space.nil_object , []) end def to_s(depth = 0) "nil" @@ -77,7 +77,7 @@ module Sol end def to_slot_definition(compiler) @my_type = compiler.receiver_type - SlotMachine::SlotDefinition.for(:message , [:receiver]) + SlotMachine::Slot.for(:message , [:receiver]) end def ct_type @my_type @@ -92,7 +92,7 @@ module Sol @value = value end def to_slot_definition(_) - return SlotMachine::SlotDefinition.for(SlotMachine::StringConstant.new(@value),[]) + return SlotMachine::Slot.for(SlotMachine::StringConstant.new(@value),[]) end def ct_type Parfait.object_space.get_type_by_class_name(:Word) diff --git a/lib/sol/call_statement.rb b/lib/sol/call_statement.rb index cd6904dd..19b523aa 100644 --- a/lib/sol/call_statement.rb +++ b/lib/sol/call_statement.rb @@ -11,7 +11,7 @@ module Sol # When used as right hand side, this tells what data to move to get the result into # a varaible. It is (off course) the return value of the message def to_slot_definition(_) - SlotMachine::SlotDefinition.for(:message ,[ :return_value]) + SlotMachine::Slot.for(:message ,[ :return_value]) end def to_s(depth = 0) diff --git a/lib/sol/lambda_expression.rb b/lib/sol/lambda_expression.rb index fd00c290..10c0ba18 100644 --- a/lib/sol/lambda_expression.rb +++ b/lib/sol/lambda_expression.rb @@ -15,7 +15,7 @@ module Sol # fact never called) def to_slot_definition(compiler) compile(compiler) unless @parfait_block - return SlotMachine::SlotDefinition.for(SlotMachine::LambdaConstant.new(parfait_block(compiler)) , []) + return SlotMachine::Slot.for(SlotMachine::LambdaConstant.new(parfait_block(compiler)) , []) end # create a block, a compiler for it, compile the block and add the compiler(code) diff --git a/lib/sol/macro_expression.rb b/lib/sol/macro_expression.rb index 8464089b..f8fd2e04 100644 --- a/lib/sol/macro_expression.rb +++ b/lib/sol/macro_expression.rb @@ -15,7 +15,7 @@ module Sol # When used as right hand side, this tells what data to move to get the result into # a varaible. It is (off course) the return value of the message def to_slot_definition(_) - SlotMachine::SlotDefinition.for(:message ,[ :return_value]) + SlotMachine::Slot.for(:message ,[ :return_value]) end def to_s(depth = 0) diff --git a/lib/sol/send_statement.rb b/lib/sol/send_statement.rb index 40b8a1a8..1cec6f51 100644 --- a/lib/sol/send_statement.rb +++ b/lib/sol/send_statement.rb @@ -116,7 +116,7 @@ module Sol defi end def build_condition(ok_label, compiler) - cached_type = SlotMachine::SlotDefinition.for(dynamic_call.cache_entry , [:cached_type]) + cached_type = SlotMachine::Slot.for(dynamic_call.cache_entry , [:cached_type]) current_type = receiver_type_definition(compiler) SlotMachine::NotSameCheck.new(cached_type , current_type, ok_label) end diff --git a/lib/sol/variables.rb b/lib/sol/variables.rb index 8232c659..57b4cc52 100644 --- a/lib/sol/variables.rb +++ b/lib/sol/variables.rb @@ -12,7 +12,7 @@ module Sol include Named def to_slot_definition(compiler) slot_def = compiler.slot_type_for(@name) - SlotMachine::SlotDefinition.for(:message , slot_def) + SlotMachine::Slot.for(:message , slot_def) end def to_s(depth = 0) name.to_s @@ -25,7 +25,7 @@ module Sol class InstanceVariable < Expression include Named def to_slot_definition(_) - SlotMachine::SlotDefinition.for(:message , [ :receiver , @name] ) + SlotMachine::Slot.for(:message , [ :receiver , @name] ) end # used to collect type information def add_ivar( array ) @@ -52,7 +52,7 @@ module Sol get_named_class.single_class.instance_type end def to_slot_definition(_) - return SlotMachine::SlotDefinition.for( get_named_class, []) + return SlotMachine::Slot.for( get_named_class, []) end def get_named_class Parfait.object_space.get_class_by_name(self.name) diff --git a/lib/sol/yield_statement.rb b/lib/sol/yield_statement.rb index 19e33ffb..d2752a9f 100644 --- a/lib/sol/yield_statement.rb +++ b/lib/sol/yield_statement.rb @@ -34,8 +34,8 @@ module Sol # we brace ourselves with the check, and exit (later raise) if . . . def method_check(compiler) ok_label = SlotMachine::Label.new(self,"method_ok_#{self.object_id}") - compile_method = SlotMachine::SlotDefinition.for( compiler.get_method , []) - runtime_method = SlotMachine::SlotDefinition.for( :message , [ :method] ) + compile_method = SlotMachine::Slot.for( compiler.get_method , []) + runtime_method = SlotMachine::Slot.for( :message , [ :method] ) check = SlotMachine::NotSameCheck.new(compile_method , runtime_method, ok_label) # TODO? Maybe create slot instructions for this #builder = compiler.builder("yield") diff --git a/test/slot_machine/instruction/test_argument_transfer.rb b/test/slot_machine/instruction/test_argument_transfer.rb index 4573e7f1..1c171c5f 100644 --- a/test/slot_machine/instruction/test_argument_transfer.rb +++ b/test/slot_machine/instruction/test_argument_transfer.rb @@ -3,7 +3,7 @@ require_relative "helper" module SlotMachine class TestArgumentTransfer < SlotMachineInstructionTest def instruction - receiver = MessageDefinition.new( [:receiver]) + receiver = MessageSlot.new( [:receiver]) arg = SlotLoad.new("test", [:message, :caller] , [:message,:type] ) ArgumentTransfer.new("" , receiver ,[arg]) end diff --git a/test/slot_machine/instruction/test_slot_definition1.rb b/test/slot_machine/instruction/test_constant_slot.rb similarity index 85% rename from test/slot_machine/instruction/test_slot_definition1.rb rename to test/slot_machine/instruction/test_constant_slot.rb index 5a73c338..eb1d845e 100644 --- a/test/slot_machine/instruction/test_slot_definition1.rb +++ b/test/slot_machine/instruction/test_constant_slot.rb @@ -2,11 +2,11 @@ require_relative "helper" module SlotMachine - class TestSlotDefinitionConstant < MiniTest::Test + class TestSlotConstant < MiniTest::Test def setup Parfait.boot!(Parfait.default_test_options) @compiler = Risc::FakeCompiler.new - @definition = SlotDefinition.for(StringConstant.new("hi") , []) + @definition = Slot.for(StringConstant.new("hi") , []) @register = @definition.to_register(@compiler , InstructionMock.new) @instruction = @compiler.instructions.first end @@ -23,11 +23,11 @@ module SlotMachine assert_equal "[StringConstant]" , @definition.to_s end end - class TestSlotDefinitionConstantType < MiniTest::Test + class TestSlotConstantType < MiniTest::Test def setup Parfait.boot!(Parfait.default_test_options) @compiler = Risc::FakeCompiler.new - @definition = SlotDefinition.for(StringConstant.new("hi") , [:type]) + @definition = Slot.for(StringConstant.new("hi") , [:type]) @register = @definition.to_register(@compiler , InstructionMock.new) @instruction = @compiler.instructions.first end diff --git a/test/slot_machine/instruction/test_slot_definition.rb b/test/slot_machine/instruction/test_message_slot.rb similarity index 84% rename from test/slot_machine/instruction/test_slot_definition.rb rename to test/slot_machine/instruction/test_message_slot.rb index 0d7b4ff1..cf589079 100644 --- a/test/slot_machine/instruction/test_slot_definition.rb +++ b/test/slot_machine/instruction/test_message_slot.rb @@ -1,10 +1,10 @@ require_relative "helper" module SlotMachine - class TestSlotDefinitionBasics < MiniTest::Test + class TestSlotBasics < MiniTest::Test def slot(slot = :caller) - MessageDefinition.new(slot) + MessageSlot.new(slot) end def test_create_ok1 assert_equal :message , slot.known_object diff --git a/test/slot_machine/instruction/test_not_same_check.rb b/test/slot_machine/instruction/test_not_same_check.rb index 646d2f84..bf56251f 100644 --- a/test/slot_machine/instruction/test_not_same_check.rb +++ b/test/slot_machine/instruction/test_not_same_check.rb @@ -3,7 +3,7 @@ require_relative "helper" module SlotMachine class TestNotSameCheck < SlotMachineInstructionTest def instruction - target = SlotDefinition.for(:message , :caller) + target = Slot.for(:message , :caller) NotSameCheck.new(target , target , Label.new("ok" , "target")) end def test_len diff --git a/test/slot_machine/instruction/test_slot.rb b/test/slot_machine/instruction/test_slot.rb new file mode 100644 index 00000000..cf589079 --- /dev/null +++ b/test/slot_machine/instruction/test_slot.rb @@ -0,0 +1,23 @@ +require_relative "helper" + +module SlotMachine + class TestSlotBasics < MiniTest::Test + + def slot(slot = :caller) + MessageSlot.new(slot) + end + def test_create_ok1 + assert_equal :message , slot.known_object + end + def test_create_ok2 + assert_equal Array , slot.slots.class + assert_equal :caller , slot.slots.first + end + def test_to_s + assert_equal "[message, caller]" , slot.to_s + end + def test_create_fail_none + assert_raises {slot(nil)} + end + end +end diff --git a/test/slot_machine/instruction/test_slot_definition2.rb b/test/slot_machine/instruction/test_slot2.rb similarity index 88% rename from test/slot_machine/instruction/test_slot_definition2.rb rename to test/slot_machine/instruction/test_slot2.rb index 25e0a2f5..14fe814f 100644 --- a/test/slot_machine/instruction/test_slot_definition2.rb +++ b/test/slot_machine/instruction/test_slot2.rb @@ -1,11 +1,11 @@ require_relative "helper" module SlotMachine - class TestSlotDefinitionKnown1 < MiniTest::Test + class TestSlotKnown1 < MiniTest::Test def setup Parfait.boot!(Parfait.default_test_options) @compiler = Risc::FakeCompiler.new - @definition = MessageDefinition.new( :caller) + @definition = MessageSlot.new( :caller) @register = @definition.to_register(@compiler , "fake source") @instruction = @compiler.instructions.first end diff --git a/test/slot_machine/instruction/test_slot_definition3.rb b/test/slot_machine/instruction/test_slot_definition3.rb deleted file mode 100644 index fd930328..00000000 --- a/test/slot_machine/instruction/test_slot_definition3.rb +++ /dev/null @@ -1,27 +0,0 @@ -require_relative "helper" - -module SlotMachine - class TestSlotDefinitionKnown2 < MiniTest::Test - def setup - Parfait.boot!(Parfait.default_test_options) - @compiler = Risc::FakeCompiler.new - @definition = MessageDefinition.new( [:caller , :type]) - @register = @definition.to_register(@compiler , InstructionMock.new) - end - def test_def_next_class - assert_equal Risc::SlotToReg , @compiler.instructions[1].class - end - def test_def_next_next_class - assert_equal NilClass , @compiler.instructions[2].class - end - def test_def_next_index - assert_equal 0 , @compiler.instructions[1].index - end - def test_def_next_register - assert_equal :r1 , @compiler.instructions[1].register.symbol - end - def test_def_next_array - assert_equal :r1 , @compiler.instructions[1].array.symbol - end - end -end diff --git a/test/slot_machine/instruction/test_truth_check.rb b/test/slot_machine/instruction/test_truth_check.rb index 73c8014a..949c570c 100644 --- a/test/slot_machine/instruction/test_truth_check.rb +++ b/test/slot_machine/instruction/test_truth_check.rb @@ -3,7 +3,7 @@ require_relative "helper" module SlotMachine class TestSameCheck < SlotMachineInstructionTest def instruction - target = MessageDefinition.new( :caller) + target = MessageSlot.new( :caller) TruthCheck.new(target , Label.new("ok" , "target")) end def test_len diff --git a/test/sol/class_send/test_class_instance.rb b/test/sol/class_send/test_class_instance.rb index 2a95093e..90b11209 100644 --- a/test/sol/class_send/test_class_instance.rb +++ b/test/sol/class_send/test_class_instance.rb @@ -53,11 +53,11 @@ module Sol assert_equal SlotLoad, @ins.class end def test_left - assert_equal MessageDefinition , @ins.left.class + assert_equal MessageSlot , @ins.left.class assert_equal [:return_value] , @ins.left.slots end def test_right - assert_equal MessageDefinition , @ins.right.class + assert_equal MessageSlot , @ins.right.class assert_equal [:receiver , :inst] , @ins.right.slots end end diff --git a/test/sol/class_send/test_class_send_inherited.rb b/test/sol/class_send/test_class_send_inherited.rb index 7ba92e83..b8948ad9 100644 --- a/test/sol/class_send/test_class_send_inherited.rb +++ b/test/sol/class_send/test_class_send_inherited.rb @@ -31,7 +31,7 @@ module Sol def test_receiver assert_equal SlotMachine::ArgumentTransfer, @ins.next(1).class assert_equal 0, @ins.next(1).arguments.length - assert_equal ObjectDefinition, @ins.next(1).receiver.class + assert_equal ObjectSlot, @ins.next(1).receiver.class assert_equal Parfait::Class, @ins.next(1).receiver.known_object.class assert_equal :Space, @ins.next(1).receiver.known_object.name end diff --git a/test/sol/class_send/test_send_class.rb b/test/sol/class_send/test_send_class.rb index 954e4a3a..20d564f6 100644 --- a/test/sol/class_send/test_send_class.rb +++ b/test/sol/class_send/test_send_class.rb @@ -34,12 +34,12 @@ module Sol assert_equal MessageSetup , @ins.class , @ins end def test_receiver - assert_equal SlotDefinition, @ins.next.receiver.class + assert_equal Slot, @ins.next.receiver.class assert_equal Parfait::Class, @ins.next.receiver.known_object.class assert_equal :Object , @ins.next.receiver.known_object.name end def test_receiver_move - assert_equal ObjectDefinition, @ins.next.receiver.class + assert_equal ObjectSlot, @ins.next.receiver.class end def test_receiver assert_equal Parfait::Class, @ins.next.receiver.known_object.class diff --git a/test/sol/lambdas/test_assign.rb b/test/sol/lambdas/test_assign.rb index 7ea12f7f..8cb19a26 100644 --- a/test/sol/lambdas/test_assign.rb +++ b/test/sol/lambdas/test_assign.rb @@ -73,7 +73,7 @@ module SolBlocks def test_assigns_move @ins = compile_main_block( "@a = arg") assert_equal SlotMachine::SlotLoad , @ins.class , @ins - assert_equal SlotMachine::MessageDefinition , @ins.right.class , @ins + assert_equal SlotMachine::MessageSlot , @ins.right.class , @ins end end diff --git a/test/sol/lambdas/test_if_condition.rb b/test/sol/lambdas/test_if_condition.rb index 3cb46f4c..9c98676a 100644 --- a/test/sol/lambdas/test_if_condition.rb +++ b/test/sol/lambdas/test_if_condition.rb @@ -12,7 +12,7 @@ module SolBlocks assert_equal TruthCheck , @ins.next(3).class end def test_condition_is_slot - assert_equal MessageDefinition , @ins.next(3).condition.class , @ins + assert_equal MessageSlot , @ins.next(3).condition.class , @ins end def test_simple_call assert_equal SimpleCall , @ins.next(2).class diff --git a/test/sol/lambdas/test_while_simple.rb b/test/sol/lambdas/test_while_simple.rb index 4ed903cf..5c2ceab4 100644 --- a/test/sol/lambdas/test_while_simple.rb +++ b/test/sol/lambdas/test_while_simple.rb @@ -15,7 +15,7 @@ module SolBlocks assert_equal TruthCheck , @ins.next.class , @ins end def test_condition_is_slot - assert_equal MessageDefinition , @ins.next.condition.class , @ins + assert_equal MessageSlot , @ins.next.condition.class , @ins end def test_array check_array [Label, TruthCheck, SlotLoad, Jump, Label, diff --git a/test/sol/send/test_send_self.rb b/test/sol/send/test_send_self.rb index e060a17a..d8f74a15 100644 --- a/test/sol/send/test_send_self.rb +++ b/test/sol/send/test_send_self.rb @@ -8,7 +8,7 @@ module Sol "self.get_internal_word(0);return" end def test_receiver - assert_equal MessageDefinition, @ins.next.receiver.class + assert_equal MessageSlot, @ins.next.receiver.class end def test_arg_one assert_equal SlotLoad, @ins.next(1).arguments[0].class @@ -23,7 +23,7 @@ module Sol assert_equal :get_internal_word, @ins.next(2).method.name end def test_receiver_move - assert_equal MessageDefinition, @ins.next.receiver.class + assert_equal MessageSlot, @ins.next.receiver.class end end diff --git a/test/sol/send/test_send_simple.rb b/test/sol/send/test_send_simple.rb index c69c8986..1692a31d 100644 --- a/test/sol/send/test_send_simple.rb +++ b/test/sol/send/test_send_simple.rb @@ -14,7 +14,7 @@ module Sol assert_equal :div4, @ins.next(2).method.name end def test_receiver_move - assert_equal ConstantDefinition, @ins.next.receiver.class + assert_equal ConstantSlot, @ins.next.receiver.class end end diff --git a/test/sol/send/test_send_simple_args.rb b/test/sol/send/test_send_simple_args.rb index 0bf1b3cb..aad09857 100644 --- a/test/sol/send/test_send_simple_args.rb +++ b/test/sol/send/test_send_simple_args.rb @@ -24,7 +24,7 @@ module Sol Label, ReturnSequence , Label] , @ins end def test_receiver_move - assert_equal ConstantDefinition, @ins.next.receiver.class + assert_equal ConstantSlot, @ins.next.receiver.class end end diff --git a/test/sol/test_assignment.rb b/test/sol/test_assignment.rb index 4341ab1f..fac1d5af 100644 --- a/test/sol/test_assignment.rb +++ b/test/sol/test_assignment.rb @@ -79,7 +79,7 @@ module Sol @compiler = compile_main( "@a = arg;return") @ins = @compiler.slot_instructions.next assert_equal SlotMachine::SlotLoad , @ins.class , @ins - assert_equal SlotMachine::MessageDefinition , @ins.right.class , @ins + assert_equal SlotMachine::MessageSlot , @ins.right.class , @ins end end diff --git a/test/sol/test_class_expression2.rb b/test/sol/test_class_expression2.rb index 8af2c6ef..7d27c14d 100644 --- a/test/sol/test_class_expression2.rb +++ b/test/sol/test_class_expression2.rb @@ -18,7 +18,7 @@ module Sol assert_equal TruthCheck , @ins.next.class , @ins end def test_condition_is_slot - assert_equal MessageDefinition , @ins.next.condition.class , @ins + assert_equal MessageSlot , @ins.next.condition.class , @ins end def test_label_after_check assert_equal Label , @ins.next(2).class , @ins diff --git a/test/sol/test_if_no_else.rb b/test/sol/test_if_no_else.rb index fa35ad93..a28c7091 100644 --- a/test/sol/test_if_no_else.rb +++ b/test/sol/test_if_no_else.rb @@ -14,7 +14,7 @@ module Sol assert_equal TruthCheck , @ins.class , @ins end def test_condition_is_slot - assert_equal MessageDefinition , @ins.condition.class , @ins + assert_equal MessageSlot , @ins.condition.class , @ins end def test_label_after_check assert_equal Label , @ins.next.class , @ins diff --git a/test/sol/test_if_no_if.rb b/test/sol/test_if_no_if.rb index f4a81725..edbf5199 100644 --- a/test/sol/test_if_no_if.rb +++ b/test/sol/test_if_no_if.rb @@ -14,7 +14,7 @@ module Sol assert_equal TruthCheck , @ins.class , @ins end def test_condition_is_slot - assert_equal MessageDefinition , @ins.condition.class , @ins + assert_equal MessageSlot , @ins.condition.class , @ins end def test_label_after_check assert_equal Label , @ins.next.class , @ins diff --git a/test/sol/test_if_simple.rb b/test/sol/test_if_simple.rb index 777244ba..fef41289 100644 --- a/test/sol/test_if_simple.rb +++ b/test/sol/test_if_simple.rb @@ -14,7 +14,7 @@ module Sol assert_equal TruthCheck , @ins.class , @ins end def test_condition_is_slot - assert_equal MessageDefinition , @ins.condition.class , @ins + assert_equal MessageSlot , @ins.condition.class , @ins end def test_label_after_check assert_equal Label , @ins.next.class , @ins diff --git a/test/sol/test_if_statement.rb b/test/sol/test_if_statement.rb index 36e41d4d..a66e255d 100644 --- a/test/sol/test_if_statement.rb +++ b/test/sol/test_if_statement.rb @@ -13,7 +13,7 @@ module Sol assert_equal TruthCheck , @ins.next(3).class end def test_condition_is_slot - assert_equal MessageDefinition , @ins.next(3).condition.class , @ins + assert_equal MessageSlot , @ins.next(3).condition.class , @ins end def test_hoisted_call assert_equal SimpleCall , @ins.next(2).class diff --git a/test/sol/test_while_statement.rb b/test/sol/test_while_statement.rb index bd6fa679..39b56972 100644 --- a/test/sol/test_while_statement.rb +++ b/test/sol/test_while_statement.rb @@ -16,7 +16,7 @@ module Sol assert_equal TruthCheck , @ins.next.class , @ins end def test_condition_is_slot - assert_equal MessageDefinition , @ins.next.condition.class , @ins + assert_equal MessageSlot , @ins.next.condition.class , @ins end def test_array check_array [Label, TruthCheck, SlotLoad, Jump, Label , diff --git a/test/sol/test_while_statement1.rb b/test/sol/test_while_statement1.rb index 4bf73a8e..237d009c 100644 --- a/test/sol/test_while_statement1.rb +++ b/test/sol/test_while_statement1.rb @@ -14,7 +14,7 @@ module Sol assert_equal TruthCheck , @ins.next(4).class end def test_condition_is_slot - assert_equal MessageDefinition , @ins.next(4).condition.class , @ins + assert_equal MessageSlot , @ins.next(4).condition.class , @ins end def test_hoisetd jump = @ins.next(8) diff --git a/test/sol/test_yield_statement.rb b/test/sol/test_yield_statement.rb index c6ab8245..55e2519a 100644 --- a/test/sol/test_yield_statement.rb +++ b/test/sol/test_yield_statement.rb @@ -28,13 +28,13 @@ module Sol assert_equal [:next_message, :arg1], left.slots end def test_check_left - assert_equal ObjectDefinition, @ins.left.class + assert_equal ObjectSlot, @ins.left.class assert_equal Parfait::CallableMethod, @ins.left.known_object.class assert_equal :main, @ins.left.known_object.name assert @ins.left.slots.empty? end def test_check_right - assert_equal MessageDefinition, @ins.right.class + assert_equal MessageSlot, @ins.right.class assert_equal :message, @ins.right.known_object assert_equal [:method] , @ins.right.slots end