diff --git a/lib/vool/statements/send_statement.rb b/lib/vool/statements/send_statement.rb index 7f9cb989..f8571b48 100644 --- a/lib/vool/statements/send_statement.rb +++ b/lib/vool/statements/send_statement.rb @@ -38,10 +38,10 @@ module Vool end def message_setup - pops = [Mom::SlotConstant.new([:message , :next_message , :receiver] , @receiver) ] + pops = [@receiver.slot_class.new([:message , :next_message , :receiver] , @receiver) ] @arguments.each_with_index do |arg , index| arg_target = [:message , :next_message , :arguments] - pops << Mom::SlotConstant.new( arg_target + [index] , arg) + pops << arg.slot_class.new( arg_target + [index] , arg) end pops end @@ -63,7 +63,7 @@ module Vool def cached_call raise "Not implemented" - [Mom::SlotConstant.new([:message , :next_message , :receiver] , @receiver) ] + [@receiver.slot_class.new([:message , :next_message , :receiver] , @receiver) ] end end diff --git a/test/mom/test_if_statement.rb b/test/mom/test_if_statement.rb index 64df4506..af75e912 100644 --- a/test/mom/test_if_statement.rb +++ b/test/mom/test_if_statement.rb @@ -24,7 +24,7 @@ module Mom assert_equal 9 , @stats.length end def test_array - check_array [SlotMove,TruthCheck,Label,SimpleCall,SlotMove,Label,SimpleCall,SlotMove,Label] , @stats + check_array [SlotMove,TruthCheck,Label,SimpleCall,SlotConstant,Label,SimpleCall,SlotConstant,Label] , @stats end end end diff --git a/test/vool/to_mom/send/test_send_simple.rb b/test/vool/to_mom/send/test_send_simple.rb index b084360e..c4ea9d3a 100644 --- a/test/vool/to_mom/send/test_send_simple.rb +++ b/test/vool/to_mom/send/test_send_simple.rb @@ -7,13 +7,14 @@ module Vool def setup Risc.machine.boot @stats = compile_first_method( "5.mod4").first + @first = @stats.first end def test_compiles_not_array assert Array != @stats.class , @stats end def test_class_compiles - assert_equal Mom::SlotMove , @stats.first.class , @stats + assert_equal Mom::SlotConstant , @first.class , @stats end def test_slot_is_set assert @stats.first.left @@ -22,13 +23,13 @@ module Vool assert_equal 2 , @stats.length end def test_receiver_move_class - assert_equal Mom::SlotMove, @stats.first.class + assert_equal Mom::SlotConstant, @first.class end def test_receiver_move - assert_equal :receiver, @stats.first.left[2] + assert_equal :receiver, @first.left[2] end def test_receiver - assert_equal IntegerStatement, @stats.first.right.class + assert_equal IntegerStatement, @first.right.class assert_equal 5, @stats.first.right.value end def test_call_is diff --git a/test/vool/to_mom/send/test_send_simple_args.rb b/test/vool/to_mom/send/test_send_simple_args.rb index e22641c0..9e96ec9e 100644 --- a/test/vool/to_mom/send/test_send_simple_args.rb +++ b/test/vool/to_mom/send/test_send_simple_args.rb @@ -13,13 +13,13 @@ module Vool assert_equal Mom::Statements , @stats.class end def test_class_compiles - assert_equal Mom::SlotMove , @stats.first.class , @stats + assert_equal Mom::SlotConstant , @stats.first.class , @stats end def test_four_instructions_are_returned assert_equal 4 , @stats.length end def test_receiver_move - assert_equal Mom::SlotMove, @stats[0].class + assert_equal Mom::SlotConstant, @stats[0].class assert_equal :receiver, @stats[0].left[2] end def test_receiver diff --git a/test/vool/to_mom/send/test_send_simple_string.rb b/test/vool/to_mom/send/test_send_simple_string.rb index d4f054d8..b75e72ea 100644 --- a/test/vool/to_mom/send/test_send_simple_string.rb +++ b/test/vool/to_mom/send/test_send_simple_string.rb @@ -7,24 +7,25 @@ module Vool def setup Risc.machine.boot @stats = compile_first_method( "'5'.get_internal_byte(1)").first + @first = @stats.first end def test_compiles_not_array assert Array != @stats.class , @stats end def test_class_compiles - assert_equal Mom::SlotMove , @stats.first.class , @stats + assert_equal Mom::SlotConstant , @first.class , @stats end def test_four_instructions_are_returned assert_equal 3 , @stats.length end def test_receiver_move - assert_equal Mom::SlotMove, @stats.first.class - assert_equal :receiver, @stats[0].left[2] + assert_equal Mom::SlotConstant, @stats.first.class + assert_equal :receiver, @first.left[2] end def test_receiver assert_equal StringStatement, @stats[0].right.class - assert_equal "5", @stats[0].right.value + assert_equal "5", @first.right.value end def test_args_one_move assert_equal :next_message, @stats[1].left[1]