rubyx/lib/vool/statements/assignment_statement.rb

28 lines
565 B
Ruby
Raw Normal View History

2017-04-01 20:28:57 +02:00
module Vool
class Assignment < Statement
attr_reader :name , :value
2017-04-02 11:59:07 +02:00
def initialize(name , value )
@name , @value = name , value
2017-04-01 20:28:57 +02:00
end
2017-04-08 11:10:42 +02:00
def collect(arr)
@value.collect(arr)
super
end
2017-04-01 20:28:57 +02:00
end
2017-04-02 11:59:07 +02:00
class LocalAssignment < Assignment
# used to collect frame information
def add_local( array )
array << @name
end
def to_mom( method )
Mom::SlotLoad.new
end
2017-04-01 20:28:57 +02:00
end
2017-04-04 17:10:28 +02:00
class InstanceAssignment < Assignment
2017-04-08 11:18:10 +02:00
# used to collect type information
def add_ivar( array )
array << @name
end
2017-04-04 17:10:28 +02:00
end
2017-04-01 20:28:57 +02:00
end