Fix vool assignments after call rework
also small fix for if and return, as they need to execute sneds and yields (not just sends), so testing for Call not SendStatement
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
module Vool
|
||||
|
||||
# Base class for assignments (local/ivar), works just as you'd expect
|
||||
# Only "quirk" maybe, that arguments are like locals
|
||||
#
|
||||
# Only actual functionality here is the compile_assign_call which compiles
|
||||
# the call, should the assigned value be a call.
|
||||
class Assignment < Statement
|
||||
attr_reader :name , :value
|
||||
def initialize(name , value )
|
||||
@ -19,9 +24,18 @@ module Vool
|
||||
at_depth(depth , "#{@name} = #{@value}")
|
||||
end
|
||||
|
||||
def chain_assign(assign , compiler)
|
||||
# The assign instruction (a slot_load) is produced by delegating the slot to derived
|
||||
# class
|
||||
#
|
||||
# When the right hand side is a CallStatement, it must be compiled, before the assign
|
||||
# is executed
|
||||
#
|
||||
# Derived classes do not implement to_mom, only slot_position
|
||||
def to_mom(compiler)
|
||||
to = Mom::SlotDefinition.new(:message , self.slot_position(compiler))
|
||||
from = @value.slot_definition(compiler)
|
||||
assign = Mom::SlotLoad.new(self,to,from)
|
||||
return assign unless @value.is_a?(CallStatement)
|
||||
raise "Move me to ruby layer"
|
||||
@value.to_mom(compiler) << assign
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user