2017-04-02 12:24:09 +02:00
|
|
|
module Vool
|
|
|
|
module Named
|
2017-04-06 15:06:51 +02:00
|
|
|
attr_reader :name
|
2017-04-02 12:24:09 +02:00
|
|
|
def initialize name
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class LocalVariable < Statement
|
|
|
|
include Named
|
2017-09-04 20:31:49 +02:00
|
|
|
def to_mom(method)
|
|
|
|
if method.args_type.variable_index(@name)
|
|
|
|
type = :arguments
|
|
|
|
else
|
|
|
|
type = :frame
|
|
|
|
end
|
|
|
|
Mom::SlotDefinition.new(:message , [type , @name])
|
|
|
|
end
|
2017-04-02 12:24:09 +02:00
|
|
|
end
|
2017-04-04 13:04:35 +02:00
|
|
|
|
|
|
|
class InstanceVariable < Statement
|
|
|
|
include Named
|
2017-09-04 20:31:49 +02:00
|
|
|
def to_mom(method)
|
|
|
|
Mom::SlotDefinition.new(:message , [ :self , @name] )
|
|
|
|
end
|
2017-04-08 11:11:52 +02:00
|
|
|
# used to collect type information
|
|
|
|
def add_ivar( array )
|
|
|
|
array << @name
|
|
|
|
end
|
2017-04-04 13:04:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
class ClassVariable < Statement
|
|
|
|
include Named
|
|
|
|
end
|
|
|
|
|
2017-04-04 17:00:21 +02:00
|
|
|
class ModuleName < Statement
|
|
|
|
include Named
|
|
|
|
end
|
2017-04-02 12:24:09 +02:00
|
|
|
end
|