2017-04-02 13:24:09 +03:00
|
|
|
module Vool
|
|
|
|
module Named
|
2017-04-06 16:06:51 +03:00
|
|
|
attr_reader :name
|
2017-04-02 13:24:09 +03:00
|
|
|
def initialize name
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class LocalVariable < Statement
|
|
|
|
include Named
|
2017-09-04 21:31:49 +03: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 13:24:09 +03:00
|
|
|
end
|
2017-04-04 14:04:35 +03:00
|
|
|
|
|
|
|
class InstanceVariable < Statement
|
|
|
|
include Named
|
2017-09-04 21:31:49 +03:00
|
|
|
def to_mom(method)
|
|
|
|
Mom::SlotDefinition.new(:message , [ :self , @name] )
|
|
|
|
end
|
2017-04-08 12:11:52 +03:00
|
|
|
# used to collect type information
|
|
|
|
def add_ivar( array )
|
|
|
|
array << @name
|
|
|
|
end
|
2017-04-04 14:04:35 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
class ClassVariable < Statement
|
|
|
|
include Named
|
|
|
|
end
|
|
|
|
|
2017-04-04 18:00:21 +03:00
|
|
|
class ModuleName < Statement
|
|
|
|
include Named
|
|
|
|
end
|
2017-04-02 13:24:09 +03:00
|
|
|
end
|