rename layout to type

this one goes to caleb for pointing it out.
Much better word
This commit is contained in:
Torsten Ruger
2016-02-25 11:50:10 -08:00
parent 3480b97eaa
commit d32b51c67b
39 changed files with 328 additions and 328 deletions

View File

@ -155,7 +155,7 @@ module Soml
end
def self.each_parfait
["word","class","layout","message" ,"integer", "object"].each do |o|
["word","class","type","message" ,"integer", "object"].each do |o|
str = File.open(File.expand_path("parfait/#{o}.soml", File.dirname(__FILE__))).read
syntax = Parser::Salama.new.parse_with_debug(str, reporter: Parslet::ErrorReporter::Deepest.new)
parts = Parser::Transform.new.apply(syntax)

View File

@ -7,10 +7,10 @@ module Soml
for_class = @clazz
raise "no class" unless for_class
index = for_class.object_layout.variable_index(name)
index = for_class.object_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_layout.add_instance_variable( name , type )
index = for_class.object_type.add_instance_variable( name , type )
# not sure how to run class code yet. later
raise "value #{value}" if value

View File

@ -10,9 +10,9 @@ module Soml
field_name = field_ast.first_from(:name)
index = clazz.object_layout.variable_index(field_name)
index = clazz.object_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_layout.type_at(index))
value = use_reg(clazz.object_type.type_at(index))
add_code Register.get_slot(statement , receiver , index, value)

View File

@ -1,6 +1,6 @@
class Class < Object
field List instance_methods
field Layout object_layout
field Type object_type
field Word name
field Word super_class_name

View File

@ -1,16 +1,16 @@
class Object
Layout get_layout()
return self.layout
Type get_type()
return self.type
end
Class get_class()
Layout l = self.layout
Type l = self.type
return l.object_class
end
Word get_class_name()
Layout l = self.layout
Type l = self.type
Class c = l.object_class
return c.name
end

View File

@ -1,4 +1,4 @@
class Layout < Object
class Type < Object
field Class object_class
field List instance_methods
field Integer indexed_length