示例#1
0
 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");
 }
示例#2
0
        // 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);
        }
示例#3
0
 // Creates a new module.
 public ObjModule(ObjString name)
 {
     Name = name;
     Variables = new List<ModuleVariable>();
 }
示例#4
0
 // 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;
 }