public static void InitClass() { foreach (ObjString s in Strings) { s.ClassObj = SophieVM.StringClass; } _initCompleted = true; Strings.Clear(); TrueString = new ObjString("true"); FalseString = new ObjString("false"); }
// Creates a new class object as well as its associated metaclass. public ObjClass(ObjClass superclass, int numFields, ObjString name) { Methods = new Method[InitialMethodSize]; Superclass = superclass; NumFields = numFields; Name = name; // Create the metaclass. ObjString metaclassName = MakeString(name + " metaclass"); ObjClass metaclass = new ObjClass(0, metaclassName) { ClassObj = ClassClass }; // Metaclasses always inherit Class and do not parallel the non-metaclass // hierarchy. metaclass.BindSuperclass(ClassClass); ClassObj = metaclass; BindSuperclass(superclass); }
// Creates a new module. public ObjModule(ObjString name) { Name = name; Variables = new List<ModuleVariable>(); }
// Creates a new "raw" class. It has no metaclass or superclass whatsoever. // This is only used for bootstrapping the initial Object and Class classes, // which are a little special. public ObjClass(int numFields, ObjString name) { Methods = new Method[InitialMethodSize]; NumFields = numFields; Name = name; }