fixing send to_vool
was hoisting unneccessarily, because not respecting basics
This commit is contained in:
parent
7b02feae7a
commit
e536a7ac88
@ -15,7 +15,7 @@ module Ruby
|
|||||||
normalize_arg(arg , arguments , statements)
|
normalize_arg(arg , arguments , statements)
|
||||||
end
|
end
|
||||||
if statements.empty?
|
if statements.empty?
|
||||||
return Vool::SendStatement.new(@name, @receiver.to_vool , @arguments)
|
return Vool::SendStatement.new(@name, @receiver.to_vool , arguments)
|
||||||
else
|
else
|
||||||
statements << Vool::SendStatement.new(@name, @receiver.to_vool , arguments)
|
statements << Vool::SendStatement.new(@name, @receiver.to_vool , arguments)
|
||||||
return statements
|
return statements
|
||||||
@ -23,8 +23,8 @@ module Ruby
|
|||||||
end
|
end
|
||||||
|
|
||||||
def normalize_arg(arg , arguments , statements)
|
def normalize_arg(arg , arguments , statements)
|
||||||
if arg.respond_to?(:slot_definition) and !arg.is_a?(SendStatement)
|
if arg.respond_to?(:ct_type) and !arg.is_a?(SendStatement)
|
||||||
arguments << arg
|
arguments << arg.to_vool
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
assign = Vool::LocalAssignment.new( "tmp_#{arg.object_id}".to_sym, arg)
|
assign = Vool::LocalAssignment.new( "tmp_#{arg.object_id}".to_sym, arg)
|
||||||
|
@ -25,23 +25,16 @@ module Ruby
|
|||||||
@lst = compile( "bar(1)").to_vool
|
@lst = compile( "bar(1)").to_vool
|
||||||
end
|
end
|
||||||
def test_class
|
def test_class
|
||||||
assert_equal Vool::Statements , @lst.class
|
assert_equal Vool::SendStatement , @lst.class
|
||||||
assert_equal 2 , @lst.length
|
|
||||||
end
|
|
||||||
def test_first
|
|
||||||
assert_equal Vool::LocalAssignment , @lst.first.class
|
|
||||||
end
|
|
||||||
def test_last
|
|
||||||
assert_equal Vool::SendStatement , @lst.last.class
|
|
||||||
end
|
end
|
||||||
def test_name
|
def test_name
|
||||||
assert_equal :bar , @lst.last.name
|
assert_equal :bar , @lst.name
|
||||||
end
|
end
|
||||||
def test_receiver
|
def test_receiver
|
||||||
assert_equal Vool::SelfExpression , @lst.last.receiver.class
|
assert_equal Vool::SelfExpression , @lst.receiver.class
|
||||||
end
|
end
|
||||||
def test_args
|
def test_args
|
||||||
assert @lst.last.arguments.first.name.to_s.start_with?("tmp")
|
assert_equal Vool::IntegerConstant , @lst.arguments.first.class
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
class TestSendSuperVool < MiniTest::Test
|
class TestSendSuperVool < MiniTest::Test
|
||||||
@ -60,21 +53,14 @@ module Ruby
|
|||||||
def setup
|
def setup
|
||||||
@lst = compile( "super(1)").to_vool
|
@lst = compile( "super(1)").to_vool
|
||||||
end
|
end
|
||||||
def test_super_args_class
|
def test_super_class
|
||||||
assert_equal Vool::Statements , @lst.class
|
assert_equal Vool::SendStatement , @lst.class
|
||||||
assert_equal 2 , @lst.length
|
|
||||||
end
|
|
||||||
def test_super_args_first
|
|
||||||
assert_equal Vool::LocalAssignment , @lst.first.class
|
|
||||||
end
|
|
||||||
def test_super_args_last
|
|
||||||
assert_equal Vool::SendStatement , @lst.last.class
|
|
||||||
end
|
end
|
||||||
def test_super_receiver
|
def test_super_receiver
|
||||||
assert_equal Vool::SuperExpression , @lst.last.receiver.class
|
assert_equal Vool::SuperExpression , @lst.receiver.class
|
||||||
end
|
end
|
||||||
def test_super_name #is nil
|
def test_super_name #is nil
|
||||||
assert_nil @lst.last.name
|
assert_nil @lst.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
class TestSendReceiverTypeVool < MiniTest::Test
|
class TestSendReceiverTypeVool < MiniTest::Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user