rubyx/lib/register/parfait/variable.rb
Torsten Ruger 3480b97eaa rename variable type to value_type
in preparation for next rename
2016-02-25 11:41:03 -08:00

20 lines
550 B
Ruby

module Parfait
class Variable < Object
def initialize type , name , value = nil
raise "not type #{type}(#{type.class})" unless Register.machine.space.get_class_by_name(type)
self.value_type , self.name , self.value = type , name , value
self.value = 0 if self.value_type == :Integer and value == nil
raise "must give name for variable" unless name
end
attributes [:value_type , :name, :value]
def to_s
"Variable(#{self.value_type} ,#{self.name})"
end
def inspect
to_s
end
end
end