From 46ed4285a25f451814fed07962320652d93ee581 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sun, 18 Mar 2018 22:36:36 +0530 Subject: [PATCH] filing at dependencies --- lib/vool/statements/send_statement.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/vool/statements/send_statement.rb b/lib/vool/statements/send_statement.rb index 0a530369..4675f7d9 100644 --- a/lib/vool/statements/send_statement.rb +++ b/lib/vool/statements/send_statement.rb @@ -15,7 +15,6 @@ module Vool def initialize(name , receiver , arguments ) @name , @receiver , @arguments = name , receiver , arguments @arguments ||= [] - @dynamic = Mom::DynamicCall.new() end def normalize @@ -30,6 +29,11 @@ module Vool end end + # lazy init this, to keep the dependency (which goes to parfait and booting) at bay + def dynamic_call + @dynamic ||= Mom::DynamicCall.new() + end + # A Send breaks down to 2 steps: # - 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 @@ -92,22 +96,22 @@ module Vool # this may look like a simple_call, but the difference is that we don't know # the method until run-time. Alas the setup is the same def call_cached_method(in_method) - message_setup(in_method) << @dynamic + message_setup(in_method) << dynamic_call end private def build_condition - cached_type = Mom::SlotDefinition.new(@dynamic.cache_entry , [:cached_type]) + cached_type = Mom::SlotDefinition.new(dynamic_call.cache_entry , [:cached_type]) current_type = Mom::SlotDefinition.new(:message , [:receiver , :type]) Mom::NotSameCheck.new(cached_type , current_type) end def build_type_cache_update - Mom::SlotLoad.new([@dynamic.cache_entry, :cached_type] , [:message , :receiver , :type]) + Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , [:message , :receiver , :type]) end def build_method_cache_update(in_method) receiver = StringConstant.new(@name) resolve = SendStatement.new(:resolve_method , receiver , [SelfExpression.new]) - move_method = Mom::SlotLoad.new([@dynamic.cache_entry, :cached_method] , [:message , :return_value]) + move_method = Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_method] , [:message , :return_value]) resolve.to_mom(in_method) << move_method end end