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
|
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
|
|
|
def to_s
|
|
|
|
name.to_s
|
|
|
|
end
|
|
|
|
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
|
|
|
|
def to_s
|
|
|
|
"@#{name}"
|
|
|
|
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
|