// friend: RubyContext // tracker: non-null => show members declared on the tracker internal RubyClass(RubyContext /*!*/ context, string name, Type type, object singletonClassOf, Action <RubyModule> initializer, RubyClass superClass, TypeTracker tracker, bool isRubyClass, bool isSingletonClass) : base(context, name, initializer, null, tracker) { Debug.Assert((superClass == null) == (type == typeof(object)), "All classes have a superclass, except for Object"); Debug.Assert(!isRubyClass || tracker == null, "Ruby class cannot have a tracker"); Debug.Assert(singletonClassOf != null || !isSingletonClass, "Singleton classes don't have a type"); Debug.Assert(superClass != this); _underlyingSystemType = type; _superClass = superClass; _isSingletonClass = isSingletonClass; _isRubyClass = isRubyClass; _singletonClassOf = singletonClassOf; if (superClass != null) { superClass.AddDependentModule(this); _structInfo = superClass._structInfo; } }
// friend: RubyContext // tracker: non-null => show members declared on the tracker internal RubyClass(RubyContext/*!*/ context, string name, Type type, object singletonClassOf, Action<RubyModule> methodsInitializer, Action<RubyModule> constantsInitializer, Delegate/*!*/[] factories, RubyClass superClass, RubyModule/*!*/[] expandedMixins, TypeTracker tracker, RubyStruct.Info structInfo, bool isRubyClass, bool isSingletonClass, ModuleRestrictions restrictions) : base(context, name, methodsInitializer, constantsInitializer, expandedMixins, type != typeof(object) ? null : context.Namespaces, tracker, restrictions) { Debug.Assert(context.Namespaces != null, "Namespaces should be initialized"); Debug.Assert(superClass != null || structInfo == null, "BasicObject is not a struct"); Debug.Assert(!isRubyClass || tracker == null, "Ruby class cannot have a tracker"); Debug.Assert(singletonClassOf != null || !isSingletonClass, "Singleton classes don't have a type"); Debug.Assert(superClass != this); _underlyingSystemType = type; _superClass = superClass; _isSingletonClass = isSingletonClass; _isRubyClass = isRubyClass; _singletonClassOf = singletonClassOf; _factories = factories ?? Utils.EmptyDelegates; if (superClass != null) { _level = superClass.Level + 1; _structInfo = structInfo ?? superClass._structInfo; } else { _level = 0; } }
// friend: RubyContext // tracker: non-null => show members declared on the tracker internal RubyClass(RubyContext/*!*/ context, string name, Type type, object singletonClassOf, Action<RubyModule> methodsInitializer, Action<RubyModule> constantsInitializer, Delegate/*!*/[] factories, RubyClass superClass, RubyModule/*!*/[] expandedMixins, TypeTracker tracker, RubyStruct.Info structInfo, bool isRubyClass, bool isSingletonClass, ModuleRestrictions restrictions) : base(context, name, methodsInitializer, constantsInitializer, expandedMixins, null, tracker, restrictions) { Debug.Assert((superClass == null) == (type == typeof(object)), "All classes have a superclass, except for Object"); Debug.Assert(superClass != null || structInfo == null, "Object is not a struct"); Debug.Assert(!isRubyClass || tracker == null, "Ruby class cannot have a tracker"); Debug.Assert(singletonClassOf != null || !isSingletonClass, "Singleton classes don't have a type"); Debug.Assert(superClass != this); _underlyingSystemType = type; _superClass = superClass; _isSingletonClass = isSingletonClass; _isRubyClass = isRubyClass; _singletonClassOf = singletonClassOf; _factories = factories ?? Utils.EmptyDelegates; if (superClass != null) { _level = superClass.Level + 1; _structInfo = structInfo ?? superClass._structInfo; } else { _level = 0; } _weakSelf = new WeakReference(this); Version = new VersionHandle(Interlocked.Increment(ref _globalVersion)); Version.SetName(name); }