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
|
2018-03-15 16:03:38 +01:00
|
|
|
def each(&block)
|
|
|
|
end
|
2017-04-02 12:24:09 +02:00
|
|
|
end
|
|
|
|
|
2018-03-15 06:54:14 +01:00
|
|
|
class LocalVariable < Expression
|
2017-04-02 12:24:09 +02:00
|
|
|
include Named
|
2018-03-15 16:03:38 +01:00
|
|
|
def slot_definition(method)
|
2018-04-05 11:22:14 +02:00
|
|
|
if method.arguments_type.variable_index(@name)
|
2017-09-04 20:31:49 +02:00
|
|
|
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
|
|
|
|
2018-03-15 06:54:14 +01:00
|
|
|
class InstanceVariable < Expression
|
2017-04-04 13:04:35 +02:00
|
|
|
include Named
|
2018-03-15 16:03:38 +01:00
|
|
|
def slot_definition(method)
|
2018-03-14 15:56:13 +01:00
|
|
|
Mom::SlotDefinition.new(:message , [ :receiver , @name] )
|
2017-09-04 20:31:49 +02:00
|
|
|
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
|
|
|
|
|
2018-03-15 06:54:14 +01:00
|
|
|
class ClassVariable < Expression
|
2017-04-04 13:04:35 +02:00
|
|
|
include Named
|
|
|
|
end
|
|
|
|
|
2018-03-15 06:54:14 +01:00
|
|
|
class ModuleName < Expression
|
2017-04-04 17:00:21 +02:00
|
|
|
include Named
|
|
|
|
end
|
2017-04-02 12:24:09 +02:00
|
|
|
end
|