]> git.saurik.com Git - cycript.git/commitdiff
Use the same trick on Array that made StringInstance.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 3 Jun 2012 19:37:15 +0000 (12:37 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 3 Jun 2012 19:37:15 +0000 (12:37 -0700)
ObjectiveC/Library.mm

index 973909930d5ab67544eff4c3b1c84a6dcc637917..c5722c87f83b7c307bbf9bf3722ff5a5f4ee0bbe 100644 (file)
@@ -296,7 +296,7 @@ JSValueRef CYGetClassPrototype(JSContextRef context, id self) {
     JSValueRef prototype;
 
     if (self == NSArray_)
-        prototype = CYGetCachedObject(context, CYJSString("Array_prototype"));
+        prototype = CYGetCachedObject(context, CYJSString("ArrayInstance_prototype"));
     else if (self == NSDictionary_)
         prototype = CYGetCachedObject(context, CYJSString("Object_prototype"));
     else if (self == NSString_)
@@ -2538,15 +2538,20 @@ void CYObjectiveC_SetupContext(JSContextRef context) { CYPoolTry {
     JSObjectRef Instance(JSObjectMakeConstructor(context, Instance_, &Instance_new));
     JSObjectRef Message(JSObjectMakeConstructor(context, Message_, NULL));
     JSObjectRef Selector(JSObjectMakeConstructor(context, Selector_, &Selector_new));
-    JSObjectRef StringInstance(JSObjectMakeConstructor(context, Instance_, NULL));
     JSObjectRef Super(JSObjectMakeConstructor(context, Super_, &Super_new));
 
     JSObjectRef Instance_prototype(CYCastJSObject(context, CYGetProperty(context, Instance, prototype_s)));
     CYSetProperty(context, cy, CYJSString("Instance_prototype"), Instance_prototype);
 
+    JSObjectRef ArrayInstance(JSObjectMakeConstructor(context, Instance_, NULL));
+    JSObjectRef ArrayInstance_prototype(CYCastJSObject(context, CYGetProperty(context, ArrayInstance, prototype_s)));
+    CYSetProperty(context, cy, CYJSString("ArrayInstance_prototype"), ArrayInstance_prototype);
+    JSObjectRef Array_prototype(CYGetCachedObject(context, CYJSString("Array_prototype")));
+    JSObjectSetPrototype(context, ArrayInstance_prototype, Array_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);
-
     JSObjectRef String_prototype(CYGetCachedObject(context, CYJSString("String_prototype")));
     JSObjectSetPrototype(context, StringInstance_prototype, String_prototype);