send refactor, green by stubbing

This commit is contained in:
Torsten Ruger 2017-09-14 18:42:01 +03:00
parent 2739747453
commit c3318f8f61
2 changed files with 25 additions and 12 deletions

View File

@ -74,16 +74,11 @@ module Vool
# if not, change and find method for the type (simple_call to resolve_method)
# conceptually easy in ruby, but we have to compile that "easy" ruby
def cache_check(in_method)
# return if cached_type == current_type
# cached_type = current_type
# cached_method = current_type.resolve_method(method.name)
check = []
cached_type = Mom::SlotDefinition.new(:message , [:frame , type_var_name])
current_type = Mom::SlotDefinition.new(:message , [:self , :type])
cond = Mom::NotSameCheck.new(cached_type , current_type)
if_true = nil #@if_true.to_mom( in_method ) #find and assign
check << Mom::IfStatement.new( cond , if_true )
check
# if cached_type != current_type
# cached_type = current_type
# cached_method = current_type.resolve_method(method.name)
if_true = [build_type_cache_update , build_method_cache_update] #@if_true.to_mom( in_method ) #find and assign
[Mom::IfStatement.new( build_condition , if_true )]
end
# this may look like a simple_call, but the difference is that we don't know
@ -105,5 +100,17 @@ module Vool
def type_var_name
"cached_type_#{object_id}"
end
private
def build_condition
cached_type = Mom::SlotDefinition.new(:message , [:frame , type_var_name])
current_type = Mom::SlotDefinition.new(:message , [:self , :type])
Mom::NotSameCheck.new(cached_type , current_type)
end
def build_type_cache_update
end
def build_method_cache_update
end
end
end

View File

@ -13,8 +13,14 @@ module Vool
def test_compiles_not_array
assert Array != @stats.class , @stats
end
def test_class_compiles
assert_equal Mom::IfStatement , @first.class , @stats
def test_if_first
assert_equal Mom::IfStatement , @first.class , @first
end
def test_if_condition_set
assert_equal Mom::NotSameCheck , @first.condition.class , @first
end
def test_if_true_set
assert @first.if_true , @first
end
def est_slot_is_set
assert @stats.first.left