fix assignments to_vool

This commit is contained in:
Torsten Ruger 2018-07-20 13:43:37 +03:00
parent e536a7ac88
commit d14eca3e70
2 changed files with 26 additions and 6 deletions

View File

@ -23,8 +23,8 @@ module Ruby
self.vool_brother.new(name,value)
end
def to_vool_send
statements = value.normalize()
def normalize_send
statements = value.to_vool
return copy( statements ) if statements.is_a?(Vool::SendStatement)
assign = statements.statements.pop
statements << copy(assign)

View File

@ -1,7 +1,7 @@
require_relative "helper"
module Ruby
class TestIvarAssignment < MiniTest::Test
class TestAssignment < MiniTest::Test
include RubyTests
def test_local
@ -12,7 +12,6 @@ module Ruby
lst = compile( "foo = bar")
assert_equal :foo , lst.name
end
def test_instance
lst = compile( "@foo = bar")
assert_equal IvarAssignment , lst.class
@ -21,12 +20,33 @@ module Ruby
lst = compile( "@foo = bar")
assert_equal :foo , lst.name
end
def test_const
lst = compile( "@foo = 5")
assert_equal IvarAssignment , lst.class
end
end
class TestAssignmentVool < MiniTest::Test
include RubyTests
def test_local
lst = compile( "foo = bar").to_vool
assert_equal Vool::LocalAssignment , lst.class
end
def test_local_name
lst = compile( "foo = bar").to_vool
assert_equal :foo , lst.name
end
def test_instance
lst = compile( "@foo = bar").to_vool
assert_equal Vool::IvarAssignment , lst.class
end
def test_instance_name
lst = compile( "@foo = bar").to_vool
assert_equal :foo , lst.name
end
def test_const
lst = compile( "@foo = 5").to_vool
assert_equal Vool::IvarAssignment , lst.class
end
end
end