ea882f403a
previously it was the toll incarnation, and that is almost the same But for the type of self. This s by definition only known in the parfait method And we need it off course for type checking/dispatch
42 lines
791 B
Ruby
42 lines
791 B
Ruby
module Vool
|
|
module Named
|
|
attr_reader :name
|
|
def initialize name
|
|
@name = name
|
|
end
|
|
def each(&block)
|
|
end
|
|
end
|
|
|
|
class LocalVariable < Expression
|
|
include Named
|
|
def slot_definition(method)
|
|
if method.arguments.variable_index(@name)
|
|
type = :arguments
|
|
else
|
|
type = :frame
|
|
end
|
|
Mom::SlotDefinition.new(:message , [type , @name])
|
|
end
|
|
end
|
|
|
|
class InstanceVariable < Expression
|
|
include Named
|
|
def slot_definition(method)
|
|
Mom::SlotDefinition.new(:message , [ :receiver , @name] )
|
|
end
|
|
# used to collect type information
|
|
def add_ivar( array )
|
|
array << @name
|
|
end
|
|
end
|
|
|
|
class ClassVariable < Expression
|
|
include Named
|
|
end
|
|
|
|
class ModuleName < Expression
|
|
include Named
|
|
end
|
|
end
|