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

@ -24,7 +24,7 @@ module Ruby
include RubyTests
def setup
@lst = compile("if(a == 1) ; a = 1 end").to_vool
@lst = compile("if(foo() == 1) ; a = 1 ; end").to_vool
end
def test_class
@ -40,8 +40,8 @@ module Ruby
assert_equal Vool::LocalAssignment , @lst.last.if_true.class
end
def test_condition
assert_equal Vool::LocalVariable , @lst.last.condition.class
assert_equal @lst.first.name , @lst.last.condition.name
assert_equal Vool::SendStatement , @lst.last.condition.class
assert_equal :== , @lst.last.condition.name
end
end