darling-libobjc2/selector.h
theraven 42a545fc7c In some irritating circumstances, the load order can cause a +load message to trigger other code, which sends messages with selectors that have not been mapped yet.
The runtime was handling the message lookup correctly in this case, but only as a side-effect of the fallback code from when type-dependent dispatch is not possible.  This resulted in a confusing warning message, telling you that you were calling a method with an incorrect signature, when the two signatures that it printed were the same.

This case is now handled correctly, so the warning disappears (unless you really are calling a method with the wrong signature and have TDD enabled).
2010-08-31 20:40:08 +00:00

47 lines
1.1 KiB
C

#ifndef OBJC_SELECTOR_H_INCLUDED
#define OBJC_SELECTOR_H_INCLUDED
/**
* Structure used to store the types for a selector. This allows for a quick
* test to see whether a selector is polymorphic and allows enumeration of all
* type encodings for a given selector.
*
* This is the same size as an objc_selector, so we can allocate them from the
* objc_selector pool.
*
* Note: For ABI v10, we can probably do something a bit more sensible here and
* make selectors into a linked list.
*/
struct sel_type_list
{
const char *value;
struct sel_type_list *next;
};
/**
* Structure used to store selectors in the list.
*/
struct objc_selector
{
const char * name;
const char * types;
};
__attribute__((unused))
static uint32_t get_untyped_idx(SEL aSel)
{
SEL untyped = sel_registerTypedName_np(sel_getName(aSel), 0);
return (uint32_t)(uintptr_t)untyped->name;
}
/**
* Returns whether a selector is mapped.
*/
BOOL sel_is_mapped(SEL selector);
/**
* Registers the selector. This selector may be returned later, so it must not
* be freed.
*/
SEL objc_register_selector(SEL aSel);
#endif // OBJC_SELECTOR_H_INCLUDED