aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-01-17 09:12:10 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-01 08:37:49 +0100
commitbe46366689eb2ed26c00b516c17b42d12c12070e (patch)
treef667331cd66eab1641cd0221d444718dedeaf927 /src/declarative
parent3a017cc96292dbda4ca9fd2ca5ac7cf8b39cd43e (diff)
Remove QJSValue::instanceOf() function
Rationale: This is a remnant from QtScript. There is no good reason for providing this type of low-level "prototype inheritance chain" checks in this high-level QJSValue class. If you want to check if an object is of the "right type", you can check if it has the properties you require using property(). Task-number: QTBUG-23604 Change-Id: I3a274212cc57c38228fab73423af481e1b95d8a5 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/v8/qjsvalue.cpp22
-rw-r--r--src/declarative/qml/v8/qjsvalue.h2
-rw-r--r--src/declarative/qml/v8/qjsvalue_impl_p.h31
-rw-r--r--src/declarative/qml/v8/qjsvalue_p.h2
4 files changed, 0 insertions, 57 deletions
diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp
index b1e31b4e74..3a49e94ca3 100644
--- a/src/declarative/qml/v8/qjsvalue.cpp
+++ b/src/declarative/qml/v8/qjsvalue.cpp
@@ -891,28 +891,6 @@ bool QJSValue::strictlyEquals(const QJSValue& other) const
return d_ptr->strictlyEquals(o);
}
-#ifdef QT_DEPRECATED
-
-/*!
- \obsolete
-
- Returns true if this QJSValue is an instance of
- \a other; otherwise returns false.
-
- This QJSValue is considered to be an instance of \a other if
- \a other is a function and the value of the \c{prototype}
- property of \a other is in the prototype chain of this
- QJSValue.
-*/
-bool QJSValue::instanceOf(const QJSValue &other) const
-{
- Q_D(const QJSValue);
- QScriptIsolate api(d->engine());
- return d->instanceOf(QJSValuePrivate::get(other));
-}
-
-#endif // QT_DEPRECATED
-
/*!
Returns the value of this QJSValue's property with the given \a name.
If no such property exists, an invalid QJSValue is returned.
diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h
index 98d04f9155..f0be07e725 100644
--- a/src/declarative/qml/v8/qjsvalue.h
+++ b/src/declarative/qml/v8/qjsvalue.h
@@ -142,8 +142,6 @@ public:
QT_DEPRECATED qint32 toInt32() const;
QT_DEPRECATED quint32 toUInt32() const;
- QT_DEPRECATED bool instanceOf(const QJSValue &other) const;
-
QT_DEPRECATED QJSValue::PropertyFlags propertyFlags(const QString &name) const;
QT_DEPRECATED QJSValue call(const QJSValue &thisObject = QJSValue(),
diff --git a/src/declarative/qml/v8/qjsvalue_impl_p.h b/src/declarative/qml/v8/qjsvalue_impl_p.h
index 304ed34566..386b203a41 100644
--- a/src/declarative/qml/v8/qjsvalue_impl_p.h
+++ b/src/declarative/qml/v8/qjsvalue_impl_p.h
@@ -603,37 +603,6 @@ inline bool QJSValuePrivate::lessThan(QJSValuePrivate *other) const
return nthis < nother;
}
-inline bool QJSValuePrivate::instanceOf(QJSValuePrivate* other) const
-{
- if (!isObject() || !other->isFunction())
- return false;
- if (engine() != other->engine()) {
- qWarning("QJSValue::instanceof: cannot perform operation on a value created in a different engine");
- return false;
- }
- v8::HandleScope handleScope;
- return instanceOf(v8::Handle<v8::Object>::Cast(other->m_value));
-}
-
-inline bool QJSValuePrivate::instanceOf(v8::Handle<v8::Object> other) const
-{
- Q_ASSERT(isObject());
- Q_ASSERT(other->IsFunction());
-
- v8::Handle<v8::Object> self = v8::Handle<v8::Object>::Cast(m_value);
- v8::Handle<v8::Value> selfPrototype = self->GetPrototype();
- v8::Handle<v8::Value> otherPrototype = other->Get(v8::String::New("prototype"));
-
- while (!selfPrototype->IsNull()) {
- if (selfPrototype->StrictEquals(otherPrototype))
- return true;
- // In general a prototype can be an object or null, but in the loop it can't be null, so
- // we can cast it safely.
- selfPrototype = v8::Handle<v8::Object>::Cast(selfPrototype)->GetPrototype();
- }
- return false;
-}
-
inline QScriptPassPointer<QJSValuePrivate> QJSValuePrivate::prototype() const
{
if (isObject()) {
diff --git a/src/declarative/qml/v8/qjsvalue_p.h b/src/declarative/qml/v8/qjsvalue_p.h
index ca349d2f2c..fd32a14bb8 100644
--- a/src/declarative/qml/v8/qjsvalue_p.h
+++ b/src/declarative/qml/v8/qjsvalue_p.h
@@ -112,8 +112,6 @@ public:
inline bool equals(QJSValuePrivate* other);
inline bool strictlyEquals(QJSValuePrivate* other);
inline bool lessThan(QJSValuePrivate *other) const;
- inline bool instanceOf(QJSValuePrivate*) const;
- inline bool instanceOf(v8::Handle<v8::Object> other) const;
inline QScriptPassPointer<QJSValuePrivate> prototype() const;
inline void setPrototype(QJSValuePrivate* prototype);