Simplify Parfait booting

Since some weeks, Parfait uses instance variables instead of generated attribute getters (that needed type)
This makes it possible to simplify the boot process, getting rid of separate boot Space and class versions.
It is still quite order dependent, but all "normal" ruby code, (less magic) so easier to understand.

Also moved all code that can never run at runtime into the adapter. This included Space and Object new, space as the space will only ever be created at compile time and object, since that is quite different at run-time (which is where i am working towards)
This commit is contained in:
2019-09-22 19:10:47 +03:00
parent a496ea7e4b
commit e61c5d4a55
11 changed files with 105 additions and 174 deletions

View File

@ -48,7 +48,7 @@ module Parfait
def test_word_class
word = @space.classes[:Word]
assert word.instance_type
t_word = @space.get_type_for(word.instance_type.hash)
t_word = @space.types[word.instance_type.hash]
assert_equal word.instance_type.hash , t_word.hash
assert_equal word.instance_type.object_id , t_word.object_id
end

View File

@ -18,7 +18,7 @@ module Parfait
def test_types_hashes
types = @space.types
types.each do |has , type|
assert has.is_a?(::Integer) , has.inspect
assert has.is_a?(::Integer) , has.class
end
end
def test_classes_types_in_space_types
@ -29,14 +29,14 @@ module Parfait
def test_class_types_are_stored
@space.classes.each do |name,clazz|
assert @space.get_type_for(clazz.instance_type.hash)
assert @space.types[clazz.instance_type.hash]
end
end
def test_class_types_are_identical
@space.classes.each do |name , clazz|
cl_type = @space.get_type_for(clazz.instance_type.hash)
assert_equal cl_type.object_id , clazz.instance_type.object_id
cl_type = @space.types[clazz.instance_type.hash]
assert_equal cl_type.object_id , clazz.instance_type.object_id , name
end
end

View File

@ -14,7 +14,7 @@ module Parfait
end
def test_length
assert @types.length > 11
assert_equal 27 , @types.length
end
def test_two_hashs_not_equal