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

@ -22,10 +22,10 @@ module Ruby
end
def to_vool
cond , rest = *normalize_name(@condition)
me = Vool::IfStatement.new(cond.to_vool , @if_true&.to_vool, @if_false&.to_vool)
return me unless rest
Vool::Statements.new([ rest.to_vool , me])
cond , hoisted = *normalized_vool(@condition)
me = Vool::IfStatement.new(cond , @if_true&.to_vool, @if_false&.to_vool)
return me unless hoisted
Vool::Statements.new( hoisted ) << me
end
def has_false?