diff --git a/lib/register/boot.rb b/lib/register/boot.rb index 4624991b..f6e5ce5a 100644 --- a/lib/register/boot.rb +++ b/lib/register/boot.rb @@ -68,7 +68,7 @@ module Register classes = space.classes type_names.each do |name , vars| cl = object_with_type Parfait::Class - cl.object_type = @types[name] + cl.instance_type = @types[name] @types[name].object_class = cl cl.instance_methods = object_with_type Parfait::List # puts "instance_methods is #{cl.instance_methods.class}" @@ -121,7 +121,7 @@ module Register :Space => {:classes => :Dictionary , :first_message => :Message}, :Frame => {:next_frame => :Frame, :indexed_length => :Integer}, :Type => {:object_class => :Class, :instance_methods => :List , :indexed_length => :Integer} , - :Class => {:instance_methods => :List, :object_type => :Type, :name => :Word, + :Class => {:instance_methods => :List, :instance_type => :Type, :name => :Word, :super_class_name => :Word}, :Dictionary => {:keys => :List , :values => :List } , :Method => {:name => :Word, :source => :Object, :instructions => :Object, :binary => :Object, diff --git a/lib/register/parfait/class.rb b/lib/register/parfait/class.rb index 4c46a41d..6d09e9d6 100644 --- a/lib/register/parfait/class.rb +++ b/lib/register/parfait/class.rb @@ -19,7 +19,7 @@ module Parfait class Class < Object include Behaviour - attributes [:object_type , :name , :super_class_name] + attributes [:instance_type , :name , :super_class_name] def initialize name , superclass super() @@ -28,7 +28,7 @@ module Parfait # the type for this class (class = object of type Class) carries the class # as an instance. The relation is from an object through the Type to it's class # TODO the object type should copy the stuff from superclass - self.object_type = Type.new(self) + self.instance_type = Type.new(self) end def allocate_object @@ -36,7 +36,7 @@ module Parfait end def add_instance_name name - self.object_type.push name + self.instance_type.push name end def sof_reference_name @@ -50,7 +50,7 @@ module Parfait def create_instance_method method_name , arguments raise "create_instance_method #{method_name}.#{method_name.class}" unless method_name.is_a?(Symbol) - clazz = object_type().object_class() + clazz = instance_type().object_class() raise "??? #{method_name}" unless clazz #puts "Self: #{self.class} clazz: #{clazz.name}" add_instance_method Method.new( clazz , method_name , arguments ) diff --git a/lib/register/parfait/object.rb b/lib/register/parfait/object.rb index 244b9869..dbf0ec71 100644 --- a/lib/register/parfait/object.rb +++ b/lib/register/parfait/object.rb @@ -24,7 +24,7 @@ module Parfait # have to grab the class, because we are in the ruby class not the parfait one cl = Space.object_space.get_class_by_name( self.name.split("::").last.to_sym) # and have to set the type before we let the object do anything. otherwise boom - object.set_type cl.object_type + object.set_type cl.instance_type object.send :initialize , *args object diff --git a/lib/register/parfait/symbol_adapter.rb b/lib/register/parfait/symbol_adapter.rb index 3ac03301..c667f7e6 100644 --- a/lib/register/parfait/symbol_adapter.rb +++ b/lib/register/parfait/symbol_adapter.rb @@ -7,7 +7,7 @@ class Symbol true end def get_type - l = Register.machine.space.classes[:Word].object_type + l = Register.machine.space.classes[:Word].instance_type #puts "LL #{l.class}" l end diff --git a/lib/register/register_value.rb b/lib/register/register_value.rb index 7ba0e106..ac361841 100644 --- a/lib/register/register_value.rb +++ b/lib/register/register_value.rb @@ -92,7 +92,7 @@ module Register real_name = clazz_name.to_s.split('_').last.capitalize.to_sym clazz = Parfait::Space.object_space.get_class_by_name(real_name) raise "Class name not given #{real_name}" unless clazz - index = clazz.object_type.variable_index( instance_name ) + index = clazz.instance_type.variable_index( instance_name ) raise "Instance name=#{instance_name} not found on #{real_name}" unless index.is_a?(Numeric) return index # the type word is at index 0, but type is a list and starts at 1 == type end diff --git a/lib/soml/compiler/class_field.rb b/lib/soml/compiler/class_field.rb index bf73ef8e..567884a2 100644 --- a/lib/soml/compiler/class_field.rb +++ b/lib/soml/compiler/class_field.rb @@ -7,10 +7,10 @@ module Soml for_class = @clazz raise "no class" unless for_class - index = for_class.object_type.variable_index(name) + index = for_class.instance_type.variable_index(name) #raise "class field already defined:#{name} for class #{for_class.name}" if index #puts "Define field #{name} on class #{for_class.name}" - index = for_class.object_type.add_instance_variable( name , type ) + index = for_class.instance_type.add_instance_variable( name , type ) # not sure how to run class code yet. later raise "value #{value}" if value diff --git a/lib/soml/compiler/field_access.rb b/lib/soml/compiler/field_access.rb index 475e74da..bc7bdeb6 100644 --- a/lib/soml/compiler/field_access.rb +++ b/lib/soml/compiler/field_access.rb @@ -10,9 +10,9 @@ module Soml field_name = field_ast.first_from(:name) - index = clazz.object_type.variable_index(field_name) + index = clazz.instance_type.variable_index(field_name) raise "field access, but no such field:#{field_name} for class #{clazz.name}" unless index - value = use_reg(clazz.object_type.type_at(index)) + value = use_reg(clazz.instance_type.type_at(index)) add_code Register.get_slot(statement , receiver , index, value) diff --git a/lib/soml/parfait/class.soml b/lib/soml/parfait/class.soml index 98aa2e80..9f61d600 100644 --- a/lib/soml/parfait/class.soml +++ b/lib/soml/parfait/class.soml @@ -1,6 +1,6 @@ class Class < Object field List instance_methods - field Type object_type + field Type instance_type field Word name field Word super_class_name diff --git a/test/register/parfait/test_type.rb b/test/register/parfait/test_type.rb index 1cf7a7d5..3b286343 100644 --- a/test/register/parfait/test_type.rb +++ b/test/register/parfait/test_type.rb @@ -65,7 +65,7 @@ class TestType < MiniTest::Test def test_class_type oc = Register.machine.boot.space.get_class_by_name( :Object ) assert_equal Parfait::Class , oc.class - type = oc.object_type + type = oc.instance_type assert_equal Parfait::Type , type.class assert_equal 1 , type.instance_names.get_length assert_equal type.first , :type @@ -119,7 +119,7 @@ class TestType < MiniTest::Test assert_equal 55 , @mess.get_internal_word(message_ind) end - def test_object_type + def test_instance_type assert_equal 2 , @mess.get_type.variable_index(:next_message) end diff --git a/test/soml/expressions/test_field_access.rb b/test/soml/expressions/test_field_access.rb index d9951977..d0c9aaca 100644 --- a/test/soml/expressions/test_field_access.rb +++ b/test/soml/expressions/test_field_access.rb @@ -25,7 +25,7 @@ HERE end def test_field - Register.machine.space.get_class_by_name(:Object).object_type.add_instance_variable(:bro,:Object) + Register.machine.space.get_class_by_name(:Object).instance_type.add_instance_variable(:bro,:Object) @root = :field_access @string_input = <