static JSClassRef Global_;
JSStringRef Array_s;
+JSStringRef constructor_s;
JSStringRef cy_s;
JSStringRef cyi_s;
JSStringRef cyt_s;
std::ostringstream str;
+ JSValueRef value(CYGetProperty(context, object, constructor_s));
+ if (JSValueIsObject(context, value)) {
+ JSObjectRef constructor(CYCastJSObject(context, value));
+ JSValueRef theory(CYGetProperty(context, constructor, prototype_s));
+ JSValueRef practice(JSObjectGetPrototype(context, object));
+
+ if (CYIsStrictEqual(context, theory, practice)) {
+ JSValueRef name(CYGetProperty(context, constructor, name_s));
+ if (!JSValueIsUndefined(context, name))
+ str << "new" << ' ' << CYPoolUTF8String(pool, context, CYJSString(context, name));
+ }
+ }
+
str << '{';
// XXX: this is, sadly, going to leak
Global_ = JSClassCreate(&definition);
Array_s = JSStringCreateWithUTF8CString("Array");
+ constructor_s = JSStringCreateWithUTF8CString("constructor");
cy_s = JSStringCreateWithUTF8CString("$cy");
cyi_s = JSStringCreateWithUTF8CString("$cyi");
cyt_s = JSStringCreateWithUTF8CString("$cyt");
if (tail_->constructor_ == NULL)
tail_->constructor_ = $ CYFunctionExpression(NULL, NULL, NULL);
+ tail_->constructor_->name_ = name_;
tail_->constructor_ = CYSuperize(context, tail_->constructor_);
context.super_ = old;