From 005b2e9f58194fedc9b009e9dc307ff440d5bdb2 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 13 Sep 2012 12:56:34 -0700 Subject: [PATCH] Use .toString() to CYONify Function, printing code. --- Execute.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 << '{'; -- 2.47.2