rubyx/lib/vool/assign_statement.rb
Torsten Ruger ae3d64eb53 moved all the normalize stuff over to the ruby layer
Which is how it should have been from the start
2018-07-19 14:47:29 +03:00

30 lines
582 B
Ruby

module Vool
class Assignment < Statement
attr_reader :name , :value
def initialize(name , value )
@name , @value = name , value
end
def each(&block)
block.call(self)
@value.each(&block)
end
def to_s(depth = 0)
at_depth(depth , "#{@name} = #{@value}")
end
end
class IvarAssignment < Assignment
def to_mom( compiler )
to = Mom::SlotDefinition.new(:message ,[ :receiver , @name])
from = @value.slot_definition(compiler)
return chain_assign( Mom::SlotLoad.new(to,from) , compiler)
end
end
end