fx ruby send args

This commit is contained in:
Torsten Ruger 2018-07-20 20:06:14 +03:00
parent d03592dfb1
commit 0238874c20
6 changed files with 13 additions and 9 deletions

View File

@ -27,7 +27,7 @@ module Ruby
arguments << arg.to_vool
return
end
assign = Vool::LocalAssignment.new( "tmp_#{arg.object_id}".to_sym, arg)
assign = Vool::LocalAssignment.new( "tmp_#{arg.object_id}".to_sym, arg.to_vool)
statements << assign
arguments << Vool::LocalVariable.new(assign.name)
end

View File

@ -27,7 +27,7 @@ module Ruby
arguments << arg
return
end
assign = LocalAssignment.new( "tmp_#{arg.object_id}".to_sym, arg)
assign = LocalAssignment.new( "tmp_#{arg.object_id}".to_sym, arg.to_vool)
statements << assign
arguments << LocalVariable.new(assign.name)
end

View File

@ -15,5 +15,10 @@ module Vool
at_depth(depth , "#{@name} = #{@value}")
end
def chain_assign(assign , compiler)
return assign unless @value.is_a?(SendStatement)
@value.to_mom(compiler) << assign
end
end
end

View File

@ -9,10 +9,6 @@ module Vool
return chain_assign( Mom::SlotLoad.new(to,from) , compiler)
end
def chain_assign(assign , compiler)
return assign unless @value.is_a?(SendStatement)
@value.to_mom(compiler) << assign
end
end
end

View File

@ -27,6 +27,9 @@ module Vool
@statements << o
self
end
def prepend(o)
@statements = [o] + @statements
end
# create mom instructions
def to_mom( compiler )

View File

@ -70,7 +70,7 @@ module Ruby
def test_instance_return
lst = compile( "return @var" ).to_vool
assert_equal InstanceVariable , lst.return_value.class
assert_equal Vool::InstanceVariable , lst.return_value.class
end
def test_class_basic
@ -81,7 +81,7 @@ module Ruby
def test_class_return
lst = compile( "return @@var" ).to_vool
assert_equal ClassVariable , lst.return_value.class
assert_equal Vool::ClassVariable , lst.return_value.class
end
def test_module_basic