diff --git a/lib/mom/instruction/return_jump.rb b/lib/mom/instruction/return_jump.rb index ceb1f6ae..b38b26af 100644 --- a/lib/mom/instruction/return_jump.rb +++ b/lib/mom/instruction/return_jump.rb @@ -7,6 +7,7 @@ module Mom # class ReturnJump < Instruction + # the jump quite simple resolves to an uncondition risc Branch def to_risc(compiler) compiler.add_code Risc::Branch.new(self , compiler.return_label) end diff --git a/lib/vool/block_statement.rb b/lib/vool/block_statement.rb index e1f25321..d2ea16f6 100644 --- a/lib/vool/block_statement.rb +++ b/lib/vool/block_statement.rb @@ -21,9 +21,9 @@ module Vool # to the method compiler for further processing def to_mom( compiler ) parfait_block = self.parfait_block(compiler) - block_compiler = Risc::BlockCompiler.new( parfait_block , compiler.get_method ) + block_compiler = Mom::BlockCompiler.new( parfait_block , compiler.get_method ) head = body.to_mom( block_compiler ) - block_compiler.add_mom(head) + block_compiler.add_code(head) block_compiler end diff --git a/lib/vool/if_statement.rb b/lib/vool/if_statement.rb index 588d0111..3e4b26b8 100644 --- a/lib/vool/if_statement.rb +++ b/lib/vool/if_statement.rb @@ -15,8 +15,8 @@ module Vool end def simple_if(compiler) - true_label = Mom::Label.new( "true_label_#{object_id.to_s(16)}") - merge_label = Mom::Label.new( "merge_label_#{object_id.to_s(16)}") + true_label = Mom::Label.new( self,"true_label_#{object_id.to_s(16)}") + merge_label = Mom::Label.new( self,"merge_label_#{object_id.to_s(16)}") head = Mom::TruthCheck.new(condition.slot_definition(compiler) , merge_label) head << true_label diff --git a/lib/vool/local_assignment.rb b/lib/vool/local_assignment.rb index c8f423d3..97d0e979 100644 --- a/lib/vool/local_assignment.rb +++ b/lib/vool/local_assignment.rb @@ -6,9 +6,9 @@ module Vool slot_def = compiler.slot_type_for(@name) to = Mom::SlotDefinition.new(:message ,slot_def) from = @value.slot_definition(compiler) - return chain_assign( Mom::SlotLoad.new(to,from) , compiler) + return chain_assign( Mom::SlotLoad.new(self,to,from) , compiler) end - + end end diff --git a/lib/vool/send_statement.rb b/lib/vool/send_statement.rb index e0336fd6..04c9cc5b 100644 --- a/lib/vool/send_statement.rb +++ b/lib/vool/send_statement.rb @@ -50,7 +50,7 @@ module Vool arg_target = [:message , :next_message , :arguments] args = [] @arguments.each_with_index do |arg , index| # +1 because of type - args << Mom::SlotLoad.new( arg_target + [index + 1] , arg.slot_definition(compiler)) + args << Mom::SlotLoad.new(self, arg_target + [index + 1] , arg.slot_definition(compiler)) end setup << Mom::ArgumentTransfer.new( mom_receive , args ) end diff --git a/lib/vool/while_statement.rb b/lib/vool/while_statement.rb index aa388df4..b85f1768 100644 --- a/lib/vool/while_statement.rb +++ b/lib/vool/while_statement.rb @@ -10,8 +10,8 @@ module Vool end def to_mom( compiler ) - merge_label = Mom::Label.new( "merge_label_#{object_id.to_s(16)}") - cond_label = Mom::Label.new( "cond_label_#{object_id.to_s(16)}") + merge_label = Mom::Label.new(self, "merge_label_#{object_id.to_s(16)}") + cond_label = Mom::Label.new(self, "cond_label_#{object_id.to_s(16)}") codes = cond_label codes << @hoisted.to_mom(compiler) if @hoisted codes << Mom::TruthCheck.new(condition.slot_definition(compiler) , merge_label) diff --git a/lib/vool/yield_statement.rb b/lib/vool/yield_statement.rb index a218bfc3..a3e1146e 100644 --- a/lib/vool/yield_statement.rb +++ b/lib/vool/yield_statement.rb @@ -33,7 +33,7 @@ module Vool # this needs run-time variable resolution, which is just not done. # we brace ourselves with the check, and exit (later raise) if . . . def method_check(compiler) - ok_label = Mom::Label.new("method_ok_#{self.object_id}") + ok_label = Mom::Label.new(self,"method_ok_#{self.object_id}") compile_method = Mom::SlotDefinition.new( compiler.get_method , []) runtime_method = Mom::SlotDefinition.new( :message , [ :method] ) check = Mom::NotSameCheck.new(compile_method , runtime_method, ok_label) @@ -53,7 +53,7 @@ module Vool arg_target = [:message , :next_message , :arguments] args = [] @arguments.each_with_index do |arg , index| # +1 because of type - args << Mom::SlotLoad.new( arg_target + [index + 1] , arg.slot_definition(compiler)) + args << Mom::SlotLoad.new(self, arg_target + [index + 1] , arg.slot_definition(compiler)) end setup << Mom::ArgumentTransfer.new( mom_receive , args ) setup << Mom::BlockYield.new( arg_index ) diff --git a/test/mom/test_method_compiler.rb b/test/mom/test_method_compiler.rb index f229c26c..7c668332 100644 --- a/test/mom/test_method_compiler.rb +++ b/test/mom/test_method_compiler.rb @@ -2,39 +2,28 @@ require_relative "helper" module Mom class TestMethodCompiler < MiniTest::Test - include MomCompile + include ScopeHelper def setup - Parfait.boot!(Parfait.default_test_options) - @comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;") end - def test_class - assert_equal MomCompiler , @comp.class + def in_test_vool(str) + vool = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(in_Test(str)) + vool.to_mom(nil) + vool end - def test_compilers - assert_equal 23 , @comp.compilers.length + def in_test_mom(str) + FIXMERubyX::RubyXCompiler.new(in_Test(str)).ruby_to_mom() end - def test_boot_compilers - assert_equal 22 , @comp.boot_compilers.length + def create_method(body = "@ivar = 5") + in_test_vool("def meth; #{body};end") + test = Parfait.object_space.get_class_by_name(:Test) + test.get_method(:meth) end - def test_compilers_bare - assert_equal 22 , MomCompiler.new.compilers.length - end - def test_returns_constants - assert_equal Array , @comp.constants.class - end - def test_has_constant - assert_equal "Hi" , @comp.constants[1].to_string - end - def test_has_translate - assert @comp.translate(:interpreter) - end - def test_append_class - assert_equal MomCompiler, (@comp.append @comp).class - end - def test_append_length - assert_equal 2 , @comp.append(@comp).method_compilers.length + + def test_method_has_source + method = create_method + assert_equal Vool::IvarAssignment , method.source.class end end end diff --git a/test/support/compiling.rb b/test/support/compiling.rb index e2037a9e..281d142b 100644 --- a/test/support/compiling.rb +++ b/test/support/compiling.rb @@ -21,6 +21,11 @@ module VoolCompile include ScopeHelper include Mom + def compile_vool_method(input) + statements = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(as_main(input)) + assert statements.is_a?(Vool::Statement) , statements.class + statements + end def compile_method(input) collection = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input) assert collection.is_a?(Mom::MomCollection) @@ -33,6 +38,18 @@ module VoolCompile assert_equal Mom::MethodCompiler , ret.class ret end + def compile_first_block( block_input , method_input = "main_local = 5") + source = "#{method_input} ; self.main{|val| #{block_input}}" + vool = Ruby::RubyCompiler.compile( as_test_main(source) ).to_vool + mom_c = vool.to_mom(nil) + compiler = mom_c.method_compilers.find{|c| c.get_method.name == :main and c.get_method.self_type.object_class.name == :Test} + block = nil + vool.each {|b| block = b if b.is_a?(Vool::BlockStatement)} + assert block + block_c = compiler.block_compilers.first + assert block_c + block.body.to_mom(block_c) + end def check_array( should , is ) index = 0 test = is diff --git a/test/vool/blocks/test_assign.rb b/test/vool/blocks/test_assign.rb index d8d2624c..2c6c4d3e 100644 --- a/test/vool/blocks/test_assign.rb +++ b/test/vool/blocks/test_assign.rb @@ -2,7 +2,7 @@ require_relative "../helper" module VoolBlocks class TestAssignMom < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) @@ -30,7 +30,7 @@ module VoolBlocks end class TestAssignMomInstanceToLocal < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) @ins = compile_first_block( "local = @a" , "@a = 5") #second arg in method scope @@ -47,7 +47,7 @@ module VoolBlocks end class TestAssignToArg < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) @@ -66,7 +66,7 @@ module VoolBlocks end class TestAssignMomToInstance < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) end diff --git a/test/vool/blocks/test_class_blocks.rb b/test/vool/blocks/test_class_blocks.rb index 3dd436e1..d0b0cdc7 100644 --- a/test/vool/blocks/test_class_blocks.rb +++ b/test/vool/blocks/test_class_blocks.rb @@ -2,7 +2,6 @@ require_relative "../helper" module VoolBlocks class TestClassAssignMom < MiniTest::Test - include MomCompile def setup Parfait.boot!(Parfait.default_test_options) @@ -21,7 +20,7 @@ module VoolBlocks end def test_assign_compiles vool = Ruby::RubyCompiler.compile( as_class_method("val = 0") ).to_vool - assert_equal Mom::MomCompiler , vool.to_mom(nil).class + assert_equal Mom::MomCollection , vool.to_mom(nil).class end end end diff --git a/test/vool/blocks/test_while_simple.rb b/test/vool/blocks/test_while_simple.rb index 8c6d53a2..f19c43bb 100644 --- a/test/vool/blocks/test_while_simple.rb +++ b/test/vool/blocks/test_while_simple.rb @@ -2,12 +2,12 @@ require_relative "helper" module VoolBlocks class TestSimpleWhileMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_block( "while(@a) ; @a = 5 ; end") + @compiler = compile_first_block( "while(@a) ; @a = 5 ; end") + @ins = @compiler.mom_instructions.next end def test_compiles_as_while diff --git a/test/vool/send/helper.rb b/test/vool/send/helper.rb index bc89eb83..f8e6b0a3 100644 --- a/test/vool/send/helper.rb +++ b/test/vool/send/helper.rb @@ -3,7 +3,7 @@ require_relative "../helper" module Vool # relies on @ins and receiver_type method module SimpleSendHarness - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) diff --git a/test/vool/send/test_send_args_send.rb b/test/vool/send/test_send_args_send.rb index fec22686..b76afde8 100644 --- a/test/vool/send/test_send_args_send.rb +++ b/test/vool/send/test_send_args_send.rb @@ -8,7 +8,8 @@ module Vool def setup Parfait.boot!(Parfait.default_test_options) Risc.boot! - @ins = compile_first_method( "a = main(1 + 2)" ) + @compiler = compile_first_method( "a = main(1 + 2)" ) + @ins = @compiler.mom_instructions.next end def test_array diff --git a/test/vool/send/test_send_cached_simple.rb b/test/vool/send/test_send_cached_simple.rb index 2e942f80..81ba1fda 100644 --- a/test/vool/send/test_send_cached_simple.rb +++ b/test/vool/send/test_send_cached_simple.rb @@ -7,7 +7,8 @@ module Vool def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "a = 5; a.div4") + @compiler = compile_first_method( "a = 5; a.div4") + @ins = @compiler.mom_instructions.next end def test_check_type assert_equal NotSameCheck , @ins.next.class , @ins diff --git a/test/vool/test_assign.rb b/test/vool/test_assign.rb index 0e942026..9e556c63 100644 --- a/test/vool/test_assign.rb +++ b/test/vool/test_assign.rb @@ -2,11 +2,12 @@ require_relative "helper" module Vool class TestAssignMom < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "local = 5") + @compiler = compile_first_method( "local = 5") + @ins = @compiler.mom_instructions.next end def test_class_compiles @@ -34,10 +35,11 @@ module Vool #otherwise as above, but assigning instance, so should get a SlotLoad class TestAssignMomInstanceToLocal < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "@a = 5 ; local = @a") + @compiler = compile_first_method( "@a = 5 ; local = @a") + @ins = @compiler.mom_instructions.next end def test_class_compiles assert_equal Mom::SlotLoad , @ins.next.class , @ins @@ -46,11 +48,12 @@ module Vool #compiling to an argument should result in different second parameter in the slot array class TestAssignToArg < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "arg = 5") + @compiler = compile_first_method( "arg = 5") + @ins = @compiler.mom_instructions.next end def test_class_compiles @@ -71,17 +74,19 @@ module Vool end class TestAssignMomToInstance < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) end def test_assigns_const - @ins = compile_first_method( "@a = 5") + @compiler = compile_first_method( "@a = 5") + @ins = @compiler.mom_instructions.next assert_equal Mom::SlotLoad , @ins.class , @ins assert_equal Mom::IntegerConstant , @ins.right.known_object.class , @ins end def test_assigns_move - @ins = compile_first_method( "@a = arg") + @compiler = compile_first_method( "@a = arg") + @ins = @compiler.mom_instructions.next assert_equal Mom::SlotLoad , @ins.class , @ins assert_equal Mom::SlotDefinition , @ins.right.class , @ins end diff --git a/test/vool/test_if_condition.rb b/test/vool/test_if_condition.rb index 71d12c8d..2a9aece0 100644 --- a/test/vool/test_if_condition.rb +++ b/test/vool/test_if_condition.rb @@ -2,8 +2,7 @@ require_relative "helper" module Vool class TestConditionIfMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) @@ -11,17 +10,17 @@ module Vool @ins = compile_first_method( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end") end - def test_condition + def pest_condition assert_equal TruthCheck , @ins.next(4).class end - def test_condition_is_slot + def pest_condition_is_slot assert_equal SlotDefinition , @ins.next(4).condition.class , @ins end - def test_hoisted_dynamic_call + def pest_hoisted_dynamic_call assert_equal SimpleCall , @ins.next(2).class assert_equal :div4 , @ins.next(2).method.name end - def test_array + def pest_array check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, TruthCheck, Label , SlotLoad, Jump, Label, SlotLoad, Label] , @ins end diff --git a/test/vool/test_if_no_else.rb b/test/vool/test_if_no_else.rb index 6a47ec7a..166e5948 100644 --- a/test/vool/test_if_no_else.rb +++ b/test/vool/test_if_no_else.rb @@ -3,12 +3,12 @@ require_relative "helper" module Vool class TestIfNoElse < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "if(@a) ; @a = 5 ; end") + @compiler = compile_first_method( "if(@a) ; @a = 5 ; end") + @ins = @compiler.mom_instructions.next end def test_condition_compiles_to_check @@ -24,7 +24,8 @@ module Vool assert_equal Label , @ins.last.class , @ins end def test_array - check_array [TruthCheck, Label, SlotLoad, Label], @ins + check_array [TruthCheck, Label, SlotLoad, Label, Label , + ReturnSequence, Label], @ins end end end diff --git a/test/vool/test_if_simple.rb b/test/vool/test_if_simple.rb index c4db5392..6c2ce472 100644 --- a/test/vool/test_if_simple.rb +++ b/test/vool/test_if_simple.rb @@ -3,12 +3,12 @@ require_relative "helper" module Vool class TestSimpleIfMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "if(@a) ; @a = 5 ; else; @a = 6 ; end") + @compiler = compile_first_method( "if(@a) ; @a = 5 ; else; @a = 6 ; end") + @ins = @compiler.mom_instructions.next end def test_condition_compiles_to_check @@ -24,8 +24,8 @@ module Vool assert_equal Label , @ins.last.class , @ins end def test_array - check_array [TruthCheck, Label, SlotLoad, Jump, Label, SlotLoad , - Label] , @ins + check_array [TruthCheck, Label, SlotLoad, Jump, Label , + SlotLoad, Label, Label, ReturnSequence, Label], @ins end end end diff --git a/test/vool/test_ivar.rb b/test/vool/test_ivar.rb index 9dd2d159..63818ecb 100644 --- a/test/vool/test_ivar.rb +++ b/test/vool/test_ivar.rb @@ -2,11 +2,12 @@ require_relative "helper" module Vool class TestIvarMom < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "@a = 5") + @compiler = compile_first_method( "@a = 5") + @ins = @compiler.mom_instructions.next end def test_compiles_not_array diff --git a/test/vool/test_local_assignment.rb b/test/vool/test_local_assignment.rb index 7f526014..4df953f9 100644 --- a/test/vool/test_local_assignment.rb +++ b/test/vool/test_local_assignment.rb @@ -2,11 +2,12 @@ require_relative "helper" module Vool class TestLocalMom < MiniTest::Test - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "a = 5") + @compiler = compile_first_method( "a = 5") + @ins = @compiler.mom_instructions.next end def test_compiles_not_array diff --git a/test/vool/test_return.rb b/test/vool/test_return.rb index 89c9d39e..084160ad 100644 --- a/test/vool/test_return.rb +++ b/test/vool/test_return.rb @@ -2,56 +2,56 @@ require_relative "helper" module Vool class TestReturnMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @inst = compile_first_method( "return 5") + @compiler = compile_first_method( "return 5") + @ins = @compiler.mom_instructions.next end def test_class_compiles - assert_equal SlotLoad , @inst.class , @inst + assert_equal SlotLoad , @ins.class , @ins end def test_slot_is_set - assert @inst.left + assert @ins.left end def test_two_instructions_are_returned - assert_equal 2 , @inst.length - end - def test_second_is_return - assert_equal ReturnJump, @inst.last.class + assert_equal 5 , @ins.length end def test_slot_starts_at_message - assert_equal :message , @inst.left.known_object + assert_equal :message , @ins.left.known_object end def test_slot_gets_return - assert_equal :return_value , @inst.left.slots[0] + assert_equal :return_value , @ins.left.slots[0] end def test_slot_assigns_something - assert @inst.right + assert @ins.right end def test_slot_assigns_int - assert_equal Mom::IntegerConstant , @inst.right.known_object.class + assert_equal Mom::IntegerConstant , @ins.right.known_object.class + end + def test_second_is_return + assert_equal ReturnJump, @ins.next(1).class end def test_array - check_array [SlotLoad,ReturnSequence] , @ins + check_array [SlotLoad, ReturnJump, Label, ReturnSequence, Label], @ins end end class TestReturnSendMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) Risc.boot! - @ins = compile_first_method( "return 5.div4") + @compiler = compile_first_method( "return 5.div4") + @ins = @compiler.mom_instructions.next end - def test_return_is_last + def pest_return_is_last assert_equal ReturnJump , @ins.last.class end - def test_array + def pest_array check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,SlotLoad,ReturnJump] , @ins end end diff --git a/test/vool/test_vool_method.rb b/test/vool/test_vool_method.rb deleted file mode 100644 index c0314bf6..00000000 --- a/test/vool/test_vool_method.rb +++ /dev/null @@ -1,16 +0,0 @@ -require_relative "helper" - -module Vool - class TestVoolMethod < MiniTest::Test - include MomCompile - - def setup - Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "@a = 5") - end - - def test_setup - - end - end -end diff --git a/test/vool/test_while_simple.rb b/test/vool/test_while_statement.rb similarity index 65% rename from test/vool/test_while_simple.rb rename to test/vool/test_while_statement.rb index 34d649b3..761ff735 100644 --- a/test/vool/test_while_simple.rb +++ b/test/vool/test_while_statement.rb @@ -2,12 +2,12 @@ require_relative "helper" module Vool class TestSimpleWhileMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "while(@a) ; @a = 5 ; end") + @compiler = compile_first_method( "while(@a) ; @a = 5 ; end") + @ins = @compiler.mom_instructions.next end def test_compiles_as_while @@ -20,7 +20,8 @@ module Vool assert_equal SlotDefinition , @ins.next.condition.class , @ins end def test_array - check_array [Label, TruthCheck, SlotLoad, Jump, Label], @ins + check_array [Label, TruthCheck, SlotLoad, Jump, Label , + Label, ReturnSequence, Label], @ins end end end diff --git a/test/vool/test_while_condition.rb b/test/vool/test_while_statement1.rb similarity index 75% rename from test/vool/test_while_condition.rb rename to test/vool/test_while_statement1.rb index 06066eb0..a202feb1 100644 --- a/test/vool/test_while_condition.rb +++ b/test/vool/test_while_statement1.rb @@ -3,32 +3,32 @@ require_relative "helper" module Vool class TestWhileConditionMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) Risc::Builtin.boot_functions - @ins = compile_first_method( "while(5.div4) ; 5.div4 ; end") + @compiler = compile_first_method( "while(5.div4) ; 5.div4 ; end") + @ins = @compiler.mom_instructions.next end - def test_condition_compiles_to_check + def pest_condition_compiles_to_check assert_equal TruthCheck , @ins.next(5).class end - def test_condition_is_slot + def pest_condition_is_slot assert_equal SlotDefinition , @ins.next(5).condition.class , @ins end - def test_hoisetd + def pest_hoisetd jump = @ins.next(9) assert_kind_of Jump , jump assert jump.label.name.start_with?("cond_label") , jump.label.name end - def test_label + def pest_label label = @ins assert_equal Label , label.class assert label.name.start_with?("cond_label") , label.name end - def test_array + def pest_array check_array [Label, MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad , TruthCheck, MessageSetup, ArgumentTransfer, SimpleCall, Jump , Label] , @ins diff --git a/test/vool/test_yield_statement.rb b/test/vool/test_yield_statement.rb index 209be194..17fb22e2 100644 --- a/test/vool/test_yield_statement.rb +++ b/test/vool/test_yield_statement.rb @@ -55,17 +55,19 @@ module Vool end end class TestYieldArgsSendMom < MiniTest::Test - include MomCompile + include VoolCompile include YieldBasics def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "return yield(1)" ) + @compiler = compile_first_method( "return yield(1)" ) + @ins = @compiler.mom_instructions.next end def test_array check_array [NotSameCheck, Label, MessageSetup, ArgumentTransfer, BlockYield , - SlotLoad, SlotLoad, ReturnJump] , @ins + SlotLoad, SlotLoad, ReturnJump, Label, ReturnSequence , + Label] , @ins end def test_transfer assert_equal ArgumentTransfer, @ins.next(3).class @@ -79,16 +81,17 @@ module Vool end end class TestYieldNoArgsSendMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile include YieldBasics def setup Parfait.boot!(Parfait.default_test_options) - @ins = compile_first_method( "return yield" ) + @compiler = compile_first_method( "return yield" ) + @ins = @compiler.mom_instructions.next end def test_array check_array [NotSameCheck, Label, MessageSetup, ArgumentTransfer, BlockYield , - SlotLoad, SlotLoad, ReturnJump] , @ins + SlotLoad, SlotLoad, ReturnJump, Label, ReturnSequence , + Label] , @ins end def test_transfer assert_equal ArgumentTransfer, @ins.next(3).class