rename variable type to value_type

in preparation for next rename
This commit is contained in:
Torsten Ruger 2016-02-25 11:41:03 -08:00
parent 6d900f384b
commit 3480b97eaa
4 changed files with 9 additions and 9 deletions

View File

@ -127,7 +127,7 @@ module Register
:Method => {:name => :Word, :source => :Object, :instructions => :Object, :binary => :Object, :Method => {:name => :Word, :source => :Object, :instructions => :Object, :binary => :Object,
:arguments => :List , :for_class => :Class, :locals => :List } , :arguments => :List , :for_class => :Class, :locals => :List } ,
:Value => {}, :Value => {},
:Variable => {:type => :Class, :name => :Word , :value => :Object} :Variable => {:value_type => :Class, :name => :Word , :value => :Object}
} }
end end

View File

@ -49,7 +49,7 @@ module Parfait
# but now we are concerned with booting, ie getting a working structure # but now we are concerned with booting, ie getting a working structure
def add_instance_variable name , type def add_instance_variable name , type
raise "Name shouldn't be nil" unless name raise "Name shouldn't be nil" unless name
raise "Type shouldn't be nil" unless type raise "Value Type shouldn't be nil" unless type
self.push(name) self.push(name)
self.push(type) self.push(type)
self.get_length self.get_length
@ -84,7 +84,7 @@ module Parfait
end end
def type_at index def type_at index
type_index = index * 2 type_index = index * 2
get(type_index) get(type_index)
end end

View File

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

View File

@ -25,7 +25,7 @@ module Soml
end end
# either an argument, so it's stored in message # either an argument, so it's stored in message
if( index = @method.has_arg(name)) if( index = @method.has_arg(name))
ret = use_reg @method.arguments[index].type ret = use_reg @method.arguments[index].value_type
add_code Register.get_slot(statement , :message , Parfait::Message.get_indexed(index), ret ) add_code Register.get_slot(statement , :message , Parfait::Message.get_indexed(index), ret )
return ret return ret
else # or a local so it is in the frame else # or a local so it is in the frame
@ -33,7 +33,7 @@ module Soml
if(index) if(index)
frame = use_reg :Frame frame = use_reg :Frame
add_code Register.get_slot(statement , :message , :frame , frame ) add_code Register.get_slot(statement , :message , :frame , frame )
ret = use_reg @method.locals[index].type ret = use_reg @method.locals[index].value_type
add_code Register.get_slot(statement , frame , Parfait::Frame.get_indexed(index), ret ) add_code Register.get_slot(statement , frame , Parfait::Frame.get_indexed(index), ret )
return ret return ret
end end