diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-01-15 11:36:57 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2015-01-23 08:07:32 +0100 |
commit | 002a5d4303b3b182ae4abc4a752c49787c1c2821 (patch) | |
tree | 69c7666ed1061c7acacee1d76597c06405459c80 /src/qml/qml/qqmlproperty.cpp | |
parent | fddc75e862032163af36d2282051758647b62d15 (diff) |
Get rid of most uses of ValueRef
Instead pass a const Value & into the functions
With our new inheritance structure, we can get rid of ValueRef
and instead simply pass a pointer to a Value again. Pointers to
Values are safe to use again now, as they are now guaranteed to
be in a place where the GC knows about them.
Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index abdb938e52..228f94503f 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1459,7 +1459,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, const QQmlPropertyData &core, QQmlContextData *context, QQmlJavaScriptExpression *expression, - const QV4::ValueRef result, bool isUndefined, + const QV4::Value &result, bool isUndefined, WriteFlags flags) { Q_ASSERT(object); @@ -1481,22 +1481,22 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, if (!isUndefined && !core.isValueTypeVirtual()) { switch (core.propType) { case QMetaType::Int: - if (result->isInteger()) - QUICK_STORE(int, result->integerValue()) - else if (result->isNumber()) - QUICK_STORE(int, result->doubleValue()) + if (result.isInteger()) + QUICK_STORE(int, result.integerValue()) + else if (result.isNumber()) + QUICK_STORE(int, result.doubleValue()) break; case QMetaType::Double: - if (result->isNumber()) - QUICK_STORE(double, result->asDouble()) + if (result.isNumber()) + QUICK_STORE(double, result.asDouble()) break; case QMetaType::Float: - if (result->isNumber()) - QUICK_STORE(float, result->asDouble()) + if (result.isNumber()) + QUICK_STORE(float, result.asDouble()) break; case QMetaType::QString: - if (result->isString()) - QUICK_STORE(QString, result->toQStringNoThrow()) + if (result.isString()) + QUICK_STORE(QString, result.toQStringNoThrow()) break; default: break; @@ -1514,7 +1514,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, if (isUndefined) { } else if (core.isQList()) { value = QV8Engine::getV4(v8engine)->toVariant(result, qMetaTypeId<QList<QObject *> >()); - } else if (result->isNull() && core.isQObject()) { + } else if (result.isNull() && core.isQObject()) { value = QVariant::fromValue((QObject *)0); } else if (core.propType == qMetaTypeId<QList<QUrl> >()) { value = resolvedUrlSequence(QV8Engine::getV4(v8engine)->toVariant(result, qMetaTypeId<QList<QUrl> >()), context); @@ -1525,7 +1525,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, if (expression->hasError()) { return false; } else if (isVarProperty) { - QV4::FunctionObject *f = result->asFunctionObject(); + QV4::FunctionObject *f = result.asFunctionObject(); if (f && f->isBinding()) { // we explicitly disallow this case to avoid confusion. Users can still store one // in an array in a var property if they need to, but the common case is user error. @@ -1543,7 +1543,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, } else if (isUndefined && type == qMetaTypeId<QVariant>()) { writeValueProperty(object, core, QVariant(), context, flags); } else if (type == qMetaTypeId<QJSValue>()) { - QV4::FunctionObject *f = result->asFunctionObject(); + QV4::FunctionObject *f = result.asFunctionObject(); if (f && f->isBinding()) { expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration.")); expression->delayedError()->setErrorObject(object); @@ -1561,7 +1561,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, expression->delayedError()->setErrorDescription(errorStr); expression->delayedError()->setErrorObject(object); return false; - } else if (QV4::FunctionObject *f = result->asFunctionObject()) { + } else if (QV4::FunctionObject *f = result.asFunctionObject()) { if (f->isBinding()) expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration.")); else |