QScriptValueImpl Object::method_isPrototypeOf(QScriptContextPrivate *context, QScriptEnginePrivate *, QScriptClassInfo *) { bool result = false; if (context->thisObject().isObject() && (context->argumentCount() > 0)) { QScriptValueImpl arg = context->argument(0); if (arg.isObject()) { QScriptValueImpl proto = arg.prototype(); if (proto.isObject()) { QScriptValueImpl self = context->thisObject(); result = self.objectValue() == proto.objectValue(); } } } return (QScriptValueImpl(result)); }
QDebug &operator<<(QDebug &d, const QScriptValueImpl &object) { d.nospace() << "QScriptValue("; switch (object.type()) { case QScript::InvalidType: d.nospace() << "Invalid)"; return d; case QScript::BooleanType: d.nospace() << "bool=" << object.toBoolean(); break; case QScript::IntegerType: d.nospace() << "int=" << object.toInt32(); break; case QScript::NumberType: d.nospace() << "qsreal=" << object.toNumber(); break; case QScript::LazyStringType: case QScript::StringType: d.nospace() << "string=" << object.toString(); break; case QScript::ReferenceType: d.nospace() << "reference"; break; case QScript::NullType: d.nospace() << "null"; break; case QScript::UndefinedType: d.nospace() << "undefined"; break; case QScript::PointerType: d.nospace() << "pointer"; break; case QScript::ObjectType: d.nospace() << object.classInfo()->name() << ",{"; QScriptObject *od = object.objectValue(); for (int i=0; i<od->memberCount(); ++i) { if (i != 0) d << ","; QScript::Member m; od->member(i, &m); if (m.isValid() && m.isObjectProperty()) { d << object.engine()->toString(m.nameId()); QScriptValueImpl o; od->get(m, &o); d.nospace() << QLatin1String(":") << (o.classInfo() ? o.classInfo()->name() : QLatin1String("?")); } } d.nospace() << "} scope={"; QScriptValueImpl scope = object.scope(); while (scope.isValid()) { Q_ASSERT(scope.isObject()); d.nospace() << " " << scope.objectValue(); scope = scope.scope(); } d.nospace() << "}"; break; } d << ")"; return d; }