mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-23 12:19:44 +00:00
Cleaner version of the last fix.
This commit is contained in:
parent
fb2e6756f6
commit
ffa7dbad8d
@ -244,7 +244,10 @@ PRIVATE BOOL objc_resolve_class(Class cls)
|
|||||||
// Fix up the ivar offsets
|
// Fix up the ivar offsets
|
||||||
objc_compute_ivar_offsets(cls);
|
objc_compute_ivar_offsets(cls);
|
||||||
// Send the +load message, if required
|
// Send the +load message, if required
|
||||||
objc_send_load_message(cls);
|
if (!objc_test_class_flag(cls, objc_class_flag_user_created))
|
||||||
|
{
|
||||||
|
objc_send_load_message(cls);
|
||||||
|
}
|
||||||
if (_objc_load_callback)
|
if (_objc_load_callback)
|
||||||
{
|
{
|
||||||
_objc_load_callback(cls, 0);
|
_objc_load_callback(cls, 0);
|
||||||
@ -486,7 +489,7 @@ Class class_getSuperclass(Class cls)
|
|||||||
if (Nil == cls) { return Nil; }
|
if (Nil == cls) { return Nil; }
|
||||||
if (!objc_test_class_flag(cls, objc_class_flag_resolved))
|
if (!objc_test_class_flag(cls, objc_class_flag_resolved))
|
||||||
{
|
{
|
||||||
return objc_getClass((const char*)cls->super_class);
|
objc_resolve_class(cls);
|
||||||
}
|
}
|
||||||
return cls->super_class;
|
return cls->super_class;
|
||||||
}
|
}
|
||||||
|
15
runtime.c
15
runtime.c
@ -700,16 +700,8 @@ Class objc_allocateClassPair(Class superclass, const char *name, size_t extraByt
|
|||||||
// in objc_resolve_class().
|
// in objc_resolve_class().
|
||||||
// If the superclass is not yet resolved, then we need to look it up
|
// If the superclass is not yet resolved, then we need to look it up
|
||||||
// via the class table.
|
// via the class table.
|
||||||
if (!objc_test_class_flag(superclass, objc_class_flag_resolved))
|
metaClass->isa = (Class)superclass->isa->isa->name;
|
||||||
{
|
metaClass->super_class = superclass->isa;
|
||||||
metaClass->super_class = (Class)objc_getClass((char*)superclass->super_class);
|
|
||||||
metaClass->isa = (Class)metaClass->super_class->isa->name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
metaClass->isa = (Class)superclass->isa->isa->name;
|
|
||||||
metaClass->super_class = superclass->isa;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
metaClass->name = strdup(name);
|
metaClass->name = strdup(name);
|
||||||
metaClass->info = objc_class_flag_meta | objc_class_flag_user_created |
|
metaClass->info = objc_class_flag_meta | objc_class_flag_user_created |
|
||||||
@ -788,9 +780,12 @@ const char *object_getClassName(id obj)
|
|||||||
return class_getName(object_getClass(obj));
|
return class_getName(object_getClass(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRIVATE void objc_resolve_class(Class);
|
||||||
|
|
||||||
void objc_registerClassPair(Class cls)
|
void objc_registerClassPair(Class cls)
|
||||||
{
|
{
|
||||||
LOCK_RUNTIME_FOR_SCOPE();
|
LOCK_RUNTIME_FOR_SCOPE();
|
||||||
class_table_insert(cls);
|
class_table_insert(cls);
|
||||||
|
objc_resolve_class(cls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user