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 new file mode 100644 index 00000000..e69de29b diff --git a/lib/slot_language/slot_maker.rb b/lib/slot_language/slot_maker.rb index 07c5b3f2..c922c4f1 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.new(:message , leaps) + SlotMachine::SlotDefinition.for(:message , leaps) end def to_s diff --git a/lib/slot_machine/instruction/message_definition.rb b/lib/slot_machine/instruction/message_definition.rb new file mode 100644 index 00000000..307bea91 --- /dev/null +++ b/lib/slot_machine/instruction/message_definition.rb @@ -0,0 +1,29 @@ +module SlotMachine + class MessageDefinition < SlotDefinition + + def initialize(slots) + super(:message , slots) + end + + def known_name + known_object + end + + # load the slots into a register + # the code is added to compiler + # the register returned + def to_register(compiler, source) + type = :Message + right = compiler.use_reg( type ) + slots = @slots.dup + left = Risc.message_reg + left = left.resolve_and_add( slots.shift , compiler) + reg = compiler.current.register + while( !slots.empty? ) + left = left.resolve_and_add( slots.shift , compiler) + end + return reg + end + + end +end diff --git a/lib/slot_machine/instruction/slot_definition.rb b/lib/slot_machine/instruction/slot_definition.rb index 6aaddf01..b9caef7c 100644 --- a/lib/slot_machine/instruction/slot_definition.rb +++ b/lib/slot_machine/instruction/slot_definition.rb @@ -1,7 +1,7 @@ module SlotMachine # A SlotDefinition defines a slot. A bit like a variable name but for objects. # - # PS: for the interested: A "developement" of Smalltalk was the + # 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) # @@ -15,6 +15,16 @@ module SlotMachine # Instructions. Or in the case of constants to ConstantLoad # class SlotDefinition + # get the right definition, depending on the object + def self.for(object , slots) + case object + when :message + MessageDefinition.new(slots) + else + SlotDefinition.new(object,slots) + end + end + attr_reader :known_object , :slots # is an array of symbols, that specifies the first the object, and then the Slot. # The first element is either a known type name (Capitalized symbol of the class name) , @@ -39,8 +49,6 @@ module SlotMachine known_object.class.short_name when Risc::Label known_object.to_s - when Symbol - known_object else "unknown" end @@ -69,14 +77,12 @@ module SlotMachine end raise "Can't have slots into Constants #{slots}" if slots.length > 1 when Parfait::Object , Risc::Label - const = const = Risc.load_constant(source, known_object , right) + const = Risc.load_constant(source, known_object , right) compiler.add_code const if slots.length > 0 # desctructively replace the existing value to be loaded if more slots compiler.add_code Risc.slot_to_reg( source , right ,slots[0], right) end - when Symbol - return sym_to_risc(compiler , source) else raise "We have a #{self} #{known_object}" end @@ -92,19 +98,5 @@ module SlotMachine return const.register end - # resolve the slots one by one to slot_to_reg instructions using the - # type information inferred from their names / type hierachy - def sym_to_risc(compiler , source) - slots = @slots.dup - raise "Not Message #{@known_object}" unless @known_object == :message - left = Risc.message_reg - left = left.resolve_and_add( slots.shift , compiler) - reg = compiler.current.register - while( !slots.empty? ) - left = left.resolve_and_add( slots.shift , compiler) - end - return reg - end - end end diff --git a/lib/slot_machine/instruction/slot_load.rb b/lib/slot_machine/instruction/slot_load.rb index 3d3f2b3c..7256c406 100644 --- a/lib/slot_machine/instruction/slot_load.rb +++ b/lib/slot_machine/instruction/slot_load.rb @@ -31,8 +31,8 @@ module SlotMachine def initialize(source , left , right, original_source = nil) super(source) @left , @right = left , right - @left = SlotDefinition.new(@left.shift , @left) if @left.is_a? Array - @right = SlotDefinition.new(@right.shift , @right) if @right.is_a? Array + @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 ) @original_source = original_source || self end @@ -81,3 +81,4 @@ module SlotMachine end require_relative "slot_definition" +require_relative "message_definition" diff --git a/lib/sol/assignment.rb b/lib/sol/assignment.rb index ab4081c9..7bb706ea 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.new(:message , self.slot_position(compiler)) + to = SlotMachine::SlotDefinition.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 f35a5e36..08f3f0bb 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.new(SlotMachine::IntegerConstant.new(@value) , []) + return SlotMachine::SlotDefinition.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.new(Parfait.object_space.true_object , []) + return SlotMachine::SlotDefinition.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.new(Parfait.object_space.false_object , []) + return SlotMachine::SlotDefinition.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.new(Parfait.object_space.nil_object , []) + return SlotMachine::SlotDefinition.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.new(:message , [:receiver]) + SlotMachine::SlotDefinition.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.new(SlotMachine::StringConstant.new(@value),[]) + return SlotMachine::SlotDefinition.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 5efa99fc..cd6904dd 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.new(:message ,[ :return_value]) + SlotMachine::SlotDefinition.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 8747d99d..fd00c290 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.new(SlotMachine::LambdaConstant.new(parfait_block(compiler)) , []) + return SlotMachine::SlotDefinition.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 d74a2660..8464089b 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.new(:message ,[ :return_value]) + SlotMachine::SlotDefinition.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 e81edf92..40b8a1a8 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.new(dynamic_call.cache_entry , [:cached_type]) + cached_type = SlotMachine::SlotDefinition.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 a93f5c2d..8232c659 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.new(:message , slot_def) + SlotMachine::SlotDefinition.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.new(:message , [ :receiver , @name] ) + SlotMachine::SlotDefinition.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.new( get_named_class, []) + return SlotMachine::SlotDefinition.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 74f1c8e8..19e33ffb 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.new( compiler.get_method , []) - runtime_method = SlotMachine::SlotDefinition.new( :message , [ :method] ) + compile_method = SlotMachine::SlotDefinition.for( compiler.get_method , []) + runtime_method = SlotMachine::SlotDefinition.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/out.txt b/out.txt new file mode 100644 index 00000000..5f12f20b --- /dev/null +++ b/out.txt @@ -0,0 +1,16 @@ +[/home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb:20 +[/home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb:20 +/home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb:20 +test/slot_machine/instruction/test_slot_definition3.rb +/slot_machine/instruction/test_slot_definition3.rb +/slot_machine/instruction/test_slot_definition3.rb +test/slot_machine/instruction/test_slot_definition3.rb +test/slot_machine/instruction/test_slot_definition2.rb +home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb:20 +home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb:20 +home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb:20 +/home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb:20 +test/slot_machine/instruction/test_slot_definition3.rb +/home/torsten/ruby-x/rubyx/lib/sol/if_statement.rb:35 +test/slot_machine/instruction/test_slot_definition.rb +/home/torsten/ruby-x/rubyx/test/slot_machine/instruction/test_slot_definition.rb:20 diff --git a/test/slot_machine/instruction/test_argument_transfer.rb b/test/slot_machine/instruction/test_argument_transfer.rb index fb8836f9..4573e7f1 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 = SlotDefinition.new(:message , [:receiver]) + receiver = MessageDefinition.new( [:receiver]) arg = SlotLoad.new("test", [:message, :caller] , [:message,:type] ) ArgumentTransfer.new("" , receiver ,[arg]) end diff --git a/test/slot_machine/instruction/test_not_same_check.rb b/test/slot_machine/instruction/test_not_same_check.rb index fd4f5217..646d2f84 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.new(:message , :caller) + target = SlotDefinition.for(:message , :caller) NotSameCheck.new(target , target , Label.new("ok" , "target")) end def test_len diff --git a/test/slot_machine/instruction/test_slot_definition.rb b/test/slot_machine/instruction/test_slot_definition.rb index 986087c9..0d7b4ff1 100644 --- a/test/slot_machine/instruction/test_slot_definition.rb +++ b/test/slot_machine/instruction/test_slot_definition.rb @@ -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 diff --git a/test/slot_machine/instruction/test_slot_definition1.rb b/test/slot_machine/instruction/test_slot_definition1.rb index 6c38435f..5a73c338 100644 --- a/test/slot_machine/instruction/test_slot_definition1.rb +++ b/test/slot_machine/instruction/test_slot_definition1.rb @@ -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 diff --git a/test/slot_machine/instruction/test_slot_definition2.rb b/test/slot_machine/instruction/test_slot_definition2.rb index a0ed1232..25e0a2f5 100644 --- a/test/slot_machine/instruction/test_slot_definition2.rb +++ b/test/slot_machine/instruction/test_slot_definition2.rb @@ -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 diff --git a/test/slot_machine/instruction/test_slot_definition3.rb b/test/slot_machine/instruction/test_slot_definition3.rb index 48f5d352..fd930328 100644 --- a/test/slot_machine/instruction/test_slot_definition3.rb +++ b/test/slot_machine/instruction/test_slot_definition3.rb @@ -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 diff --git a/test/slot_machine/instruction/test_truth_check.rb b/test/slot_machine/instruction/test_truth_check.rb index 34fc9b62..73c8014a 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 = SlotDefinition.new(:message , :caller) + target = MessageDefinition.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 3860ce2f..2a95093e 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 SlotDefinition , @ins.left.class + assert_equal MessageDefinition , @ins.left.class assert_equal [:return_value] , @ins.left.slots end def test_right - assert_equal SlotDefinition , @ins.right.class + assert_equal MessageDefinition , @ins.right.class assert_equal [:receiver , :inst] , @ins.right.slots end end diff --git a/test/sol/lambdas/test_assign.rb b/test/sol/lambdas/test_assign.rb index 90988c95..7ea12f7f 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::SlotDefinition , @ins.right.class , @ins + assert_equal SlotMachine::MessageDefinition , @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 be36d3bd..3cb46f4c 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 SlotDefinition , @ins.next(3).condition.class , @ins + assert_equal MessageDefinition , @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 c80de3a2..4ed903cf 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 SlotDefinition , @ins.next.condition.class , @ins + assert_equal MessageDefinition , @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 334c909a..e060a17a 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 SlotDefinition, @ins.next.receiver.class + assert_equal MessageDefinition, @ins.next.receiver.class end def test_arg_one assert_equal SlotLoad, @ins.next(1).arguments[0].class @@ -22,6 +22,10 @@ module Sol def test_call_has_right_method assert_equal :get_internal_word, @ins.next(2).method.name end + def test_receiver_move + assert_equal MessageDefinition, @ins.next.receiver.class + end + end class TestSendSelfImplicitSlotMachine < TestSendSelfSlotMachine diff --git a/test/sol/test_assignment.rb b/test/sol/test_assignment.rb index 7c704a78..4341ab1f 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::SlotDefinition , @ins.right.class , @ins + assert_equal SlotMachine::MessageDefinition , @ins.right.class , @ins end end diff --git a/test/sol/test_class_expression2.rb b/test/sol/test_class_expression2.rb index 4fe6c2ff..8af2c6ef 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 SlotDefinition , @ins.next.condition.class , @ins + assert_equal MessageDefinition , @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 ccc3dfc9..fa35ad93 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 SlotDefinition , @ins.condition.class , @ins + assert_equal MessageDefinition , @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 2645be8a..f4a81725 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 SlotDefinition , @ins.condition.class , @ins + assert_equal MessageDefinition , @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 f55b7b59..777244ba 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 SlotDefinition , @ins.condition.class , @ins + assert_equal MessageDefinition , @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 e2b274ee..36e41d4d 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 SlotDefinition , @ins.next(3).condition.class , @ins + assert_equal MessageDefinition , @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 2d8ee7ed..bd6fa679 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 SlotDefinition , @ins.next.condition.class , @ins + assert_equal MessageDefinition , @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 a8fefd42..4bf73a8e 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 SlotDefinition , @ins.next(4).condition.class , @ins + assert_equal MessageDefinition , @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 99941328..a12f710d 100644 --- a/test/sol/test_yield_statement.rb +++ b/test/sol/test_yield_statement.rb @@ -34,7 +34,7 @@ module Sol assert @ins.left.slots.empty? end def test_check_right - assert_equal SlotDefinition, @ins.right.class + assert_equal MessageDefinition, @ins.right.class assert_equal :message, @ins.right.known_object assert_equal [:method] , @ins.right.slots end