From 0d64cb32c6d51eac037c39bdb21a68ebdd69ee5e Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 20 Jan 2014 02:29:23 -0800 Subject: [PATCH] Try to CYON pointers as the address of their value. --- Execute.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Execute.cpp b/Execute.cpp index 1c8983c..61acaf2 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -1248,13 +1248,18 @@ static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRe JSObjectRef Array(CYGetCachedObject(context, CYJSString("Array_prototype"))); JSObjectRef toCYON(CYCastJSObject(context, CYGetProperty(context, Array, toCYON_s))); return CYCallAsFunction(context, toCYON, _this, count, arguments); - } else try { - CYPool pool; - return CYCastJSValue(context, pool.strcat("&", CYPoolCCYON(pool, context, CYGetProperty(context, _this, cyi_s)), NULL)); - } catch (const CYException &e) { + } else if (internal->type_->type_ == NULL) pointer: { char string[32]; sprintf(string, "%p", internal->value_); return CYCastJSValue(context, string); + } try { + JSValueRef value(CYGetProperty(context, _this, cyi_s)); + if (JSValueIsUndefined(context, value)) + goto pointer; + CYPool pool; + return CYCastJSValue(context, pool.strcat("&", CYPoolCCYON(pool, context, value), NULL)); + } catch (const CYException &e) { + goto pointer; } } CYCatch(NULL) } -- 2.47.2