+ Pointer_privateData *data(reinterpret_cast<Pointer_privateData *>(JSObjectGetPrivate(object)));
+ return CYCastJSValue(context, reinterpret_cast<uintptr_t>(data->value_));
+}
+
+JSValueRef Selector_getProperty_prototype(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) {
+ return Function_;
+}
+
+static JSValueRef Pointer_callAsFunction_valueOf(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ CYTry {
+ Pointer_privateData *data(reinterpret_cast<Pointer_privateData *>(JSObjectGetPrivate(_this)));
+ return CYCastJSValue(context, reinterpret_cast<uintptr_t>(data->value_));
+ } CYCatch
+}
+
+static JSValueRef Pointer_callAsFunction_toJSON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ return Pointer_callAsFunction_valueOf(context, object, _this, count, arguments, exception);
+}
+
+static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ CYTry {
+ Pointer_privateData *data(reinterpret_cast<Pointer_privateData *>(JSObjectGetPrivate(_this)));
+ char string[32];
+ sprintf(string, "%p", data->value_);
+ return CYCastJSValue(context, string);
+ } CYCatch
+}
+
+static JSValueRef Instance_callAsFunction_toCYON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ CYTry {
+ Instance_privateData *data(reinterpret_cast<Instance_privateData *>(JSObjectGetPrivate(_this)));
+ CYPoolTry {
+ return CYCastJSValue(context, CYJSString([data->GetValue() cy$toCYON]));
+ } CYPoolCatch(NULL)
+ } CYCatch
+}
+
+static JSValueRef Instance_callAsFunction_toJSON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ CYTry {
+ Instance_privateData *data(reinterpret_cast<Instance_privateData *>(JSObjectGetPrivate(_this)));
+ CYPoolTry {
+ NSString *key(count == 0 ? nil : CYCastNSString(NULL, CYJSString(context, arguments[0])));
+ return CYCastJSValue(context, CYJSString([data->GetValue() cy$toJSON:key]));
+ } CYPoolCatch(NULL)
+ } CYCatch
+}
+
+static JSValueRef Instance_callAsFunction_toString(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ CYTry {
+ Instance_privateData *data(reinterpret_cast<Instance_privateData *>(JSObjectGetPrivate(_this)));
+ CYPoolTry {
+ return CYCastJSValue(context, CYJSString([data->GetValue() description]));
+ } CYPoolCatch(NULL)
+ } CYCatch
+}
+
+static JSValueRef Selector_callAsFunction_toString(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ CYTry {
+ Selector_privateData *data(reinterpret_cast<Selector_privateData *>(JSObjectGetPrivate(_this)));
+ return CYCastJSValue(context, sel_getName(data->GetValue()));
+ } CYCatch
+}
+
+static JSValueRef Selector_callAsFunction_toJSON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ return Selector_callAsFunction_toString(context, object, _this, count, arguments, exception);
+}
+
+static JSValueRef Selector_callAsFunction_toCYON(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ CYTry {
+ Selector_privateData *data(reinterpret_cast<Selector_privateData *>(JSObjectGetPrivate(_this)));
+ const char *name(sel_getName(data->GetValue()));
+ CYPoolTry {
+ return CYCastJSValue(context, CYJSString([NSString stringWithFormat:@"@selector(%s)", name]));
+ } CYPoolCatch(NULL)
+ } CYCatch
+}
+
+static JSValueRef Selector_callAsFunction_type(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) {
+ CYTry {
+ if (count != 2)
+ @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"incorrect number of arguments to Selector.type" userInfo:nil];
+ CYPool pool;
+ Selector_privateData *data(reinterpret_cast<Selector_privateData *>(JSObjectGetPrivate(_this)));
+ Class _class(CYCastNSObject(pool, context, arguments[0]));
+ bool instance(CYCastBool(context, arguments[1]));
+ SEL sel(data->GetValue());
+ if (Method method = (*(instance ? &class_getInstanceMethod : class_getClassMethod))(_class, sel))
+ return CYCastJSValue(context, method_getTypeEncoding(method));
+ else if (NSString *type = [[Bridge_ objectAtIndex:1] objectForKey:CYCastNSString(pool, sel_getName(sel))])
+ return CYCastJSValue(context, CYJSString(type));
+ else
+ return CYJSNull(context);
+ } CYCatch