From 11f3e89e6b60ef97ca4f885126e50621dce37bde Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 3 Jun 2012 13:58:49 -0700 Subject: [PATCH 1/1] Use the same trick on Object that made StringInstance. --- ObjectiveC/Library.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index c5722c8..64281a3 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -298,7 +298,7 @@ JSValueRef CYGetClassPrototype(JSContextRef context, id self) { if (self == NSArray_) prototype = CYGetCachedObject(context, CYJSString("ArrayInstance_prototype")); else if (self == NSDictionary_) - prototype = CYGetCachedObject(context, CYJSString("Object_prototype")); + prototype = CYGetCachedObject(context, CYJSString("ObjectInstance_prototype")); else if (self == NSString_) prototype = CYGetCachedObject(context, CYJSString("StringInstance_prototype")); else @@ -2549,6 +2549,12 @@ void CYObjectiveC_SetupContext(JSContextRef context) { CYPoolTry { JSObjectRef Array_prototype(CYGetCachedObject(context, CYJSString("Array_prototype"))); JSObjectSetPrototype(context, ArrayInstance_prototype, Array_prototype); + JSObjectRef ObjectInstance(JSObjectMakeConstructor(context, Instance_, NULL)); + JSObjectRef ObjectInstance_prototype(CYCastJSObject(context, CYGetProperty(context, ObjectInstance, prototype_s))); + CYSetProperty(context, cy, CYJSString("ObjectInstance_prototype"), ObjectInstance_prototype); + JSObjectRef Object_prototype(CYGetCachedObject(context, CYJSString("Object_prototype"))); + JSObjectSetPrototype(context, ObjectInstance_prototype, Object_prototype); + JSObjectRef StringInstance(JSObjectMakeConstructor(context, Instance_, NULL)); JSObjectRef StringInstance_prototype(CYCastJSObject(context, CYGetProperty(context, StringInstance, prototype_s))); CYSetProperty(context, cy, CYJSString("StringInstance_prototype"), StringInstance_prototype); -- 2.45.2