refactor: split class creation into raw single-class and superclass binding phases

The bootstrapping of Object and Class now uses a two-phase approach: first creating a raw class with no metaclass or superclass via wrenNewSingleClass, then explicitly wiring superclass relationships with wrenBindSuperclass. This eliminates the need for special-case handling of null superclasses in the old newClass function and makes the metaclass chain setup explicit in wrenInitializeCore.
This commit is contained in:
Bob Nystrom
2013-12-22 04:44:37 +00:00
parent 8bb1a94a25
commit 91873b3a90
4 changed files with 105 additions and 49 deletions
+10
View File
@@ -0,0 +1,10 @@
class Foo {}
// A class is a class.
IO.write(Foo is Class) // expect: true
// It's metatype is also a class.
IO.write(Foo.type is Class) // expect: true
// The metatype's metatype is Class.
IO.write(Foo.type.type == Class) // expect: true