2018-06-29 21:46:39 +02:00
|
|
|
module Vool
|
|
|
|
module Named
|
|
|
|
attr_reader :name
|
|
|
|
def initialize name
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
def each(&block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class LocalVariable < Expression
|
|
|
|
include Named
|
2018-07-05 13:02:38 +02:00
|
|
|
def slot_definition(compiler)
|
2018-07-09 18:32:17 +02:00
|
|
|
slot_def = compiler.slot_type_for(@name)
|
|
|
|
Mom::SlotDefinition.new(:message , slot_def)
|
2018-06-29 21:46:39 +02:00
|
|
|
end
|
2018-07-03 21:18:19 +02:00
|
|
|
def to_s
|
|
|
|
name.to_s
|
|
|
|
end
|
2018-06-29 21:46:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
class InstanceVariable < Expression
|
|
|
|
include Named
|
2018-07-05 13:02:38 +02:00
|
|
|
def slot_definition(compiler)
|
2018-06-29 21:46:39 +02:00
|
|
|
Mom::SlotDefinition.new(:message , [ :receiver , @name] )
|
|
|
|
end
|
|
|
|
# used to collect type information
|
|
|
|
def add_ivar( array )
|
|
|
|
array << @name
|
|
|
|
end
|
2018-07-03 21:18:19 +02:00
|
|
|
def to_s
|
|
|
|
"@#{name}"
|
|
|
|
end
|
2018-06-29 21:46:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
class ClassVariable < Expression
|
|
|
|
include Named
|
|
|
|
end
|
|
|
|
|
|
|
|
class ModuleName < Expression
|
|
|
|
include Named
|
|
|
|
end
|
|
|
|
end
|