fix send normalisation
This commit is contained in:
parent
672ccb351d
commit
1685ba5a44
@ -20,7 +20,7 @@ module Vool
|
||||
def normalize
|
||||
statements = Statements.new([])
|
||||
arguments = []
|
||||
@arguments.dup.each_with_index do |arg , index |
|
||||
@arguments.each_with_index do |arg , index |
|
||||
normalize_arg(arg , arguments , statements)
|
||||
end
|
||||
if statements.empty?
|
||||
@ -30,6 +30,7 @@ module Vool
|
||||
return statements
|
||||
end
|
||||
end
|
||||
|
||||
def normalize_arg(arg , arguments , statements)
|
||||
if arg.respond_to?(:slot_definition) and !arg.is_a?(SendStatement)
|
||||
arguments << arg
|
||||
@ -37,7 +38,7 @@ module Vool
|
||||
end
|
||||
assign = LocalAssignment.new( "tmp_#{arg.object_id}".to_sym, arg)
|
||||
statements << assign
|
||||
arguments << assign.name
|
||||
arguments << LocalVariable.new(assign.name)
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
@ -30,6 +30,18 @@ module Vool
|
||||
def test_assigned
|
||||
assert_equal SendStatement , @stm.first.value.class
|
||||
end
|
||||
def test_length
|
||||
assert_equal 2 , @stm.length
|
||||
end
|
||||
def test_last_class
|
||||
assert_equal SendStatement , @stm.last.class
|
||||
end
|
||||
def test_last_arg
|
||||
assert_equal LocalVariable , @stm.last.arguments.first.class
|
||||
end
|
||||
def test_last_send
|
||||
assert_equal :foo , @stm.last.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user