- Instance_prototype_ = (JSObjectRef) CYGetProperty(context, Instance, prototype_s);
- JSValueProtect(context, Instance_prototype_);
-
- CYSetProperty(context, global, CYJSString("Instance"), Instance);
- CYSetProperty(context, global, CYJSString("Selector"), Selector);
- CYSetProperty(context, global, CYJSString("Super"), Super);
-
-#if defined(__APPLE__) && defined(__arm__)
- CYSetProperty(context, global, CYJSString("objc_registerClassPair"), JSObjectMakeFunctionWithCallback(context, CYJSString("objc_registerClassPair"), &objc_registerClassPair_));
+ JSObjectRef Instance_prototype(CYCastJSObject(context, CYGetProperty(context, Instance, prototype_s)));
+ CYSetProperty(context, cy, CYJSString("Instance_prototype"), Instance_prototype);
+
+ JSObjectRef ArrayInstance(JSObjectMakeConstructor(context, ArrayInstance_, 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 FunctionInstance(JSObjectMakeConstructor(context, FunctionInstance_, NULL));
+ JSObjectRef FunctionInstance_prototype(CYCastJSObject(context, CYGetProperty(context, FunctionInstance, prototype_s)));
+ CYSetProperty(context, cy, CYJSString("FunctionInstance_prototype"), FunctionInstance_prototype);
+ JSObjectRef Function_prototype(CYGetCachedObject(context, CYJSString("Function_prototype")));
+ JSObjectSetPrototype(context, FunctionInstance_prototype, Function_prototype);
+
+ JSObjectRef ObjectInstance(JSObjectMakeConstructor(context, ObjectInstance_, 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, StringInstance_, 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);
+
+ JSObjectRef Class_prototype(CYCastJSObject(context, CYGetProperty(context, Class, prototype_s)));
+ CYSetProperty(context, cy, CYJSString("Class_prototype"), Class_prototype);
+ JSObjectSetPrototype(context, Class_prototype, Instance_prototype);
+
+ CYSetProperty(context, cycript, CYJSString("Instance"), Instance);
+ CYSetProperty(context, cycript, CYJSString("Selector"), Selector);
+ CYSetProperty(context, cycript, CYJSString("Super"), Super);
+
+ JSObjectRef box(JSObjectMakeFunctionWithCallback(context, CYJSString("box"), &Instance_box_callAsFunction));
+ CYSetProperty(context, Instance, CYJSString("box"), box);
+
+#if defined(__APPLE__) && defined(__arm__) && 0
+ CYSetProperty(context, all, CYJSString("objc_registerClassPair"), &objc_registerClassPair_, kJSPropertyAttributeDontEnum);