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

@ -16,8 +16,14 @@ module Vool
# - store the given return value, this is a SlotMove
# - activate return sequence (reinstantiate old message and jump to return address)
def to_mom( compiler )
ret = Mom::SlotLoad.new( self , [:message , :return_value] ,
load = Mom::SlotLoad.new( self , [:message , :return_value] ,
@return_value.slot_definition(compiler) )
if @return_value.is_a?(SendStatement)
ret = @return_value.to_mom(compiler)
ret << load
else
ret = load
end
ret << Mom::ReturnJump.new(self , compiler.return_label )
end