// 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);
}