diff --git a/lib/rubyx/rubyx_compiler.rb b/lib/rubyx/rubyx_compiler.rb index b10f710f..25952c0d 100644 --- a/lib/rubyx/rubyx_compiler.rb +++ b/lib/rubyx/rubyx_compiler.rb @@ -125,7 +125,6 @@ module RubyX parfait = ["object"] parfait.each do |file| path = File.expand_path("../../parfait/#{file}.rb",__FILE__) - puts "Loading #{path}" ruby_to_vool(File.read(path)) end end diff --git a/lib/vool/send_statement.rb b/lib/vool/send_statement.rb index c19bd555..652baa4e 100644 --- a/lib/vool/send_statement.rb +++ b/lib/vool/send_statement.rb @@ -36,12 +36,13 @@ module Vool # - Setting up the next message, with receiver, arguments, and (importantly) return address # - a CachedCall , or a SimpleCall, depending on wether the receiver type can be determined def to_mom( compiler ) + puts "Compiling #{self.to_s}" @receiver = SelfExpression.new(compiler.receiver_type) if @receiver.is_a?(SelfExpression) if(@receiver.ct_type) - simple_call(compiler) - else - cached_call(compiler) + method = @receiver.ct_type.resolve_method(self.name) + return simple_call(compiler, method) if method end + cached_call(compiler) end def message_setup(compiler,called_method) @@ -55,10 +56,7 @@ module Vool setup << Mom::ArgumentTransfer.new(self, mom_receive , args ) end - def simple_call(compiler) - type = @receiver.ct_type - called_method = type.resolve_method(@name) - raise "No method #{@name} for #{type}" unless called_method + def simple_call(compiler, called_method) message_setup(compiler,called_method) << Mom::SimpleCall.new(called_method) end diff --git a/test/vool/send/test_not_found.rb b/test/vool/send/test_not_found.rb new file mode 100644 index 00000000..4fc1736b --- /dev/null +++ b/test/vool/send/test_not_found.rb @@ -0,0 +1,28 @@ +require_relative "../helper" + +module Vool + class TestSendCachedSimpleMom < MiniTest::Test + include VoolCompile + + def setup + Parfait.boot!(Parfait.default_test_options) + @compiler = compile_first_method( "5.div8") + @ins = @compiler.mom_instructions.next + end + def test_check_type + assert_equal NotSameCheck , @ins.class , @ins + end + def test_check_resolve_call + assert_equal ResolveMethod , @ins.next(2).class , @ins + end + def test_dynamic_call_last + assert_equal DynamicCall , @ins.next(6).class , @ins + end + + def test_array + check_array [NotSameCheck, SlotLoad, ResolveMethod, Label, MessageSetup , + ArgumentTransfer, DynamicCall, Label, ReturnSequence, Label] , @ins + end + + end +end