ObjFW  Diff

Differences From Artifact [584f60ba59]:

To Artifact [34d39a737b]:


24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
#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







|
>
|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#import "macros.h"

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

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

		objc_initialize_class(cls);

		if (!(cls->info & OBJC_CLASS_INFO_SETUP)) {
			if (is_class)
				return objc_msg_lookup(nil, sel);
			else
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
		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);
}

BOOL
class_respondsToSelector(Class cls, SEL sel)
{
	if (cls == Nil)
		return NO;







|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
		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), object_getClassName(obj));
}

BOOL
class_respondsToSelector(Class cls, SEL sel)
{
	if (cls == Nil)
		return NO;
79
80
81
82
83
84
85
86

87
88
89
90
91
92
93
objc_msg_lookup(id obj, SEL sel)
{
	IMP imp;

	if (obj == nil)
		return (IMP)nil_method;

	imp = objc_sparsearray_get(obj->isa->dtable, (uint32_t)sel->uid);


	if (imp == NULL)
		return objc_not_found_handler(obj, sel);

	return imp;
}








|
>







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
objc_msg_lookup(id obj, SEL sel)
{
	IMP imp;

	if (obj == nil)
		return (IMP)nil_method;

	imp = objc_sparsearray_get(object_getClass(obj)->dtable,
	    (uint32_t)sel->uid);

	if (imp == NULL)
		return objc_not_found_handler(obj, sel);

	return imp;
}