Make [NSObject -class] return self if self is a class. This is needed for a weird bit of the ObjC spec relating to metaclasses of root classes. The GNUstep runtime behaviour mimics the Apple behaviour, while the GCC runtime mimics the StepStone behaviour, so we get some somewhat irritating differences.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32037 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2011-02-10 18:33:26 +00:00
parent 068624b659
commit a8cd2e588c

View file

@ -1119,7 +1119,10 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
*/
- (Class) class
{
return object_getClass(self);
id cls = object_getClass(self);
if (class_isMetaClass(cls))
return (Class)self;
return cls;
}
/**