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