From: Jay Freeman (saurik) Date: Thu, 13 Sep 2012 19:56:34 +0000 (-0700) Subject: Use .toString() to CYONify Function, printing code. X-Git-Tag: v0.9.459~1 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/005b2e9f58194fedc9b009e9dc307ff440d5bdb2?ds=sidebyside Use .toString() to CYONify Function, printing code. --- diff --git a/Execute.cpp b/Execute.cpp index f8b70e5..4012186 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -401,6 +401,16 @@ const char *CYPoolCCYON(apr_pool_t *pool, JSContextRef context, JSObjectRef obje return cyon; } + if (JSObjectIsFunction(context, object)) { + JSValueRef toString(CYGetProperty(context, object, toString_s)); + if (CYIsCallable(context, toString)) { + JSValueRef arguments[1] = {CYCastJSValue(context, CYJSString(""))}; + JSValueRef value(CYCallAsFunction(context, (JSObjectRef) toString, object, 1, arguments)); + _assert(value != NULL); + return CYPoolCString(pool, context, value); + } + } + std::ostringstream str; str << '{';