From 2c4a8bb6222b88ff96fbf25372179646ce15f706 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 28 Aug 2016 13:29:56 -0700 Subject: [PATCH] Instance's toPointer() should return as CFTypeRef. --- ObjectiveC/Library.mm | 4 +--- sig/types.hpp | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index d0d824f..29d7be4 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -2650,9 +2650,7 @@ static JSValueRef Instance_callAsFunction_toPointer(JSContextRef context, JSObje if (!CYJSValueIsNSObject(context, _this)) return NULL; Instance *internal(reinterpret_cast(JSObjectGetPrivate(_this))); - // XXX: return CYMakePointer(context, internal->value_, sig::Object(class_getName(object_getClass(internal->value_))), NULL, object); - // XXX: return CYMakePointer(context, internal->value_, sig::Meta(), NULL, object); - return CYCastJSValue(context, reinterpret_cast(internal->value_)); + return CYMakePointer(context, internal->value_, sig::Void(true), NULL, object); } CYCatch(NULL) return /*XXX*/ NULL; } static JSValueRef Instance_callAsFunction_toString(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry { diff --git a/sig/types.hpp b/sig/types.hpp index 30d8dbd..78729c4 100644 --- a/sig/types.hpp +++ b/sig/types.hpp @@ -104,6 +104,14 @@ struct Signature { struct Void : Type { + Void() { + } + + Void(bool constant) { + if (constant) + flags |= JOC_TYPE_CONST; + } + Void *Copy(CYPool &pool, const char *rename = NULL) const override; const char *Encode(CYPool &pool) const override; -- 2.47.2