Fix if statements hoisting, now that send is working

Same same, just have to remembe to actually execute the condition if it is a send
Having send a possible expression, removes one tmp variable and associated move, for a little extra work.
Next return and assign (rest)
This commit is contained in:
2019-08-16 18:42:57 +03:00
parent dee1e24c28
commit e6c30d98fb
11 changed files with 80 additions and 37 deletions

View File

@ -1,26 +1,15 @@
require_relative "helper"
module Ruby
class TestLocalAssignment < MiniTest::Test
class TestVoolCallMulti2 < MiniTest::Test
include RubyTests
def test_local
lst = compile( "foo = bar")
assert_equal LocalAssignment , lst.class
include RubyTests
def setup
@lst = compile( "@foo = a.call(b)").to_vool
end
def test_local_name
lst = compile( "foo = bar")
assert_equal :foo , lst.name
def test_s
assert_equal "" , @lst.to_s
end
def test_local_const
lst = compile( "foo = 5")
assert_equal LocalAssignment , lst.class
end
def test_local_ivar
lst = compile( "foo = @iv")
assert_equal LocalAssignment , lst.class
assert_equal InstanceVariable , lst.value.class
end
end
end