aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-10-30 22:30:01 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-10-31 15:42:42 +0100
commit0704d2be63b484cb579c1507223db3f914b1338a (patch)
tree66d4e616545d7f576125e85cc108c7e2988cecdd /src/qml/types
parente67948823d6810c2de784859da52a261bf80b550 (diff)
Get rid of !this and similar constructs
The C++ standard doesn't allow calling member functions on a mull object. Fix all such places, by moving the checks to the caller where required. Change-Id: I10fb22acaf0324d8ffd3a6d8e19152e5d32f56bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index e8b29b2e44..639df4f846 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -3277,11 +3277,10 @@ public:
static QV4::ReturnedValue getIndexed(QV4::Managed *m, uint index, bool *hasProperty)
{
+ Q_ASSERT(m->as<QQmlDelegateModelGroupChangeArray>());
QV4::ExecutionEngine *v4 = m->engine();
QV4::Scope scope(v4);
- QV4::Scoped<QQmlDelegateModelGroupChangeArray> array(scope, m->as<QQmlDelegateModelGroupChangeArray>());
- if (!array)
- return v4->currentContext()->throwTypeError();
+ QV4::Scoped<QQmlDelegateModelGroupChangeArray> array(scope, static_cast<QQmlDelegateModelGroupChangeArray *>(m));
if (index >= array->count()) {
if (hasProperty)
@@ -3303,9 +3302,8 @@ public:
static QV4::ReturnedValue get(QV4::Managed *m, QV4::String *name, bool *hasProperty)
{
- QQmlDelegateModelGroupChangeArray *array = m->as<QQmlDelegateModelGroupChangeArray>();
- if (!array)
- return m->engine()->currentContext()->throwTypeError();
+ Q_ASSERT(m->as<QQmlDelegateModelGroupChangeArray>());
+ QQmlDelegateModelGroupChangeArray *array = static_cast<QQmlDelegateModelGroupChangeArray *>(m);
if (name->equals(m->engine()->id_length)) {
if (hasProperty)
@@ -3316,8 +3314,7 @@ public:
return Object::get(m, name, hasProperty);
}
static void destroy(Managed *that) {
- QQmlDelegateModelGroupChangeArray *array = that->as<QQmlDelegateModelGroupChangeArray>();
- array->d()->~Data();
+ static_cast<QQmlDelegateModelGroupChangeArray *>(that)->d()->~Data();
}
};