2018-07-19 13:59:10 +02:00
|
|
|
module Ruby
|
2018-07-20 19:53:35 +02:00
|
|
|
class Variable < Statement
|
2018-07-19 13:59:10 +02:00
|
|
|
attr_reader :name
|
2018-07-20 19:53:35 +02:00
|
|
|
|
2018-07-19 13:59:10 +02:00
|
|
|
def initialize name
|
|
|
|
@name = name
|
|
|
|
end
|
2018-07-20 19:53:35 +02:00
|
|
|
|
2018-07-20 13:22:26 +02:00
|
|
|
def to_vool
|
|
|
|
vool_brother.new(@name)
|
|
|
|
end
|
2019-09-06 20:00:37 +02:00
|
|
|
def to_s(depth=0)
|
|
|
|
name.to_s
|
|
|
|
end
|
2018-07-19 13:59:10 +02:00
|
|
|
end
|
|
|
|
|
2018-07-20 19:53:35 +02:00
|
|
|
class LocalVariable < Variable
|
2018-07-19 13:59:10 +02:00
|
|
|
end
|
|
|
|
|
2018-07-20 19:53:35 +02:00
|
|
|
class InstanceVariable < Variable
|
|
|
|
|
2018-07-19 13:59:10 +02:00
|
|
|
# used to collect type information
|
|
|
|
def add_ivar( array )
|
|
|
|
array << @name
|
|
|
|
end
|
2019-08-16 13:09:56 +02:00
|
|
|
def to_s(depth = 0)
|
2019-09-06 20:00:37 +02:00
|
|
|
"@#{name}"
|
2018-07-19 13:59:10 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-20 19:53:35 +02:00
|
|
|
class ClassVariable < Variable
|
2018-07-19 13:59:10 +02:00
|
|
|
end
|
|
|
|
|
2018-07-20 19:53:35 +02:00
|
|
|
class ModuleName < Variable
|
2018-07-19 13:59:10 +02:00
|
|
|
end
|
|
|
|
end
|