ObjFW  Diff

Differences From Artifact [9ff82b2e4e]:

To Artifact [584f60ba59]:


24
25
26
27
28
29
30























31
32
33
34
35
36
37
#import "macros.h"

IMP (*objc_forward_handler)(id, SEL) = NULL;

IMP
objc_not_found_handler(id obj, SEL sel)
{























	if (objc_forward_handler != NULL)
		return objc_forward_handler(obj, sel);

	ERROR("Selector %s is not implemented for class %s!",
	    sel_getName(sel), obj->isa->name);
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#import "macros.h"

IMP (*objc_forward_handler)(id, SEL) = NULL;

IMP
objc_not_found_handler(id obj, SEL sel)
{
	if (!(obj->isa->info & OBJC_CLASS_INFO_INITIALIZED)) {
		BOOL is_class = obj->isa->info & OBJC_CLASS_INFO_METACLASS;
		Class cls = (is_class ? (Class)obj : obj->isa);

		objc_initialize_class(cls);

		if (!(cls->info & OBJC_CLASS_INFO_SETUP)) {
			if (is_class)
				return objc_msg_lookup(nil, sel);
			else
				ERROR("Could not dispatch message for "
				    "incomplete class %s!", cls->name);
		}

		/*
		 * We don't need to handle the case that super was called.
		 * The reason for this is that a call to super is not possible
		 * before a message to the class has been sent and it thus has
		 * been initialized together with its superclasses.
		 */
		return objc_msg_lookup(obj, sel);
	}

	if (objc_forward_handler != NULL)
		return objc_forward_handler(obj, sel);

	ERROR("Selector %s is not implemented for class %s!",
	    sel_getName(sel), obj->isa->name);
}