ObjFW  Diff

Differences From Artifact [04350ea410]:

To Artifact [227edc0aad]:

  • File src/runtime/class.m — part of check-in [0e35ae63a5] at 2012-04-08 15:03:59 on branch runtime — Return Nil for incomplete classes.

    It's better to handle the class like it does not even exist in case it
    is not completely loaded. Throwing an error there introcudes trouble
    with static instances which try to get the class before initializing the
    static instances, so objc_lookup_class() should never throw an error. (user: js, size: 9246) [annotate] [blame] [check-ins using]


220
221
222
223
224
225
226
227
228
229




230
231
232
233
234
235
236
220
221
222
223
224
225
226



227
228
229
230
231
232
233
234
235
236
237







-
-
-
+
+
+
+







	 */
	if (cls->info & OBJC_CLASS_INFO_INITIALIZED) {
		objc_global_mutex_unlock();
		return cls;
	}

	if ((superclass = ((struct objc_abi_class*)cls)->superclass) != NULL) {
		if ((cls->superclass = objc_lookup_class(superclass)) == Nil)
			ERROR("Class %s not found, which is the superclass for "
			    "class %s!", superclass, cls->name);
		if ((cls->superclass = objc_lookup_class(superclass)) == Nil) {
			objc_global_mutex_unlock();
			return Nil;
		}

		cls->isa->superclass = cls->superclass->isa;

		add_subclass(cls);
		add_subclass(cls->isa);
	} else
		cls->isa->superclass = cls;