aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4sequenceobject.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-09-30 16:34:28 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-10-07 15:17:06 +0200
commite8e03215654ca730243336a80453cf9396cbdf58 (patch)
tree011ffaecb0d016ee288891e12351f83a95eee25a /src/qml/jsruntime/qv4sequenceobject.cpp
parent81faddec9c6607834da4fdb931f81f29e1f7ac69 (diff)
QML: Drop the "succeeded" out parameters from SequencePrototype
The success of the operation is visible from the return value in all cases. Change-Id: I93177785f76b8078ddd8eeb7d77143993fe80739 Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4sequenceobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 261c55af30..4415ca4d52 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -568,7 +568,7 @@ ReturnedValue SequencePrototype::method_sort(const FunctionObject *b, const Valu
ReturnedValue SequencePrototype::newSequence(
QV4::ExecutionEngine *engine, QMetaType sequenceType, QObject *object,
- int propertyIndex, bool readOnly, bool *succeeded)
+ int propertyIndex, bool readOnly)
{
QV4::Scope scope(engine);
// This function is called when the property is a QObject Q_PROPERTY of
@@ -578,23 +578,20 @@ ReturnedValue SequencePrototype::newSequence(
const QQmlType qmlType = QQmlMetaType::qmlListType(sequenceType);
if (qmlType.isSequentialContainer()) {
- *succeeded = true;
QV4::ScopedObject obj(scope, engine->memoryManager->allocate<Sequence>(
object, propertyIndex, qmlType, readOnly));
return obj.asReturnedValue();
}
- *succeeded = false;
return Encode::undefined();
}
-ReturnedValue SequencePrototype::fromVariant(
- QV4::ExecutionEngine *engine, const QVariant &v, bool *succeeded)
+ReturnedValue SequencePrototype::fromVariant(QV4::ExecutionEngine *engine, const QVariant &v)
{
- return fromData(engine, v.metaType(), v.constData(), succeeded);
+ return fromData(engine, v.metaType(), v.constData());
}
-ReturnedValue SequencePrototype::fromData(ExecutionEngine *engine, QMetaType type, const void *data, bool *succeeded)
+ReturnedValue SequencePrototype::fromData(ExecutionEngine *engine, QMetaType type, const void *data)
{
QV4::Scope scope(engine);
// This function is called when assigning a sequence value to a normal JS var
@@ -604,12 +601,10 @@ ReturnedValue SequencePrototype::fromData(ExecutionEngine *engine, QMetaType typ
const QQmlType qmlType = QQmlMetaType::qmlListType(type);
if (qmlType.isSequentialContainer()) {
- *succeeded = true;
QV4::ScopedObject obj(scope, engine->memoryManager->allocate<Sequence>(qmlType, data));
return obj.asReturnedValue();
}
- *succeeded = false;
return Encode::undefined();
}
@@ -619,14 +614,11 @@ QVariant SequencePrototype::toVariant(const Sequence *object)
return object->toVariant();
}
-QVariant SequencePrototype::toVariant(const QV4::Value &array, QMetaType typeHint, bool *succeeded)
+QVariant SequencePrototype::toVariant(const QV4::Value &array, QMetaType typeHint)
{
- *succeeded = true;
-
- if (!array.as<ArrayObject>()) {
- *succeeded = false;
+ if (!array.as<ArrayObject>())
return QVariant();
- }
+
QV4::Scope scope(array.as<Object>()->engine());
QV4::ScopedArrayObject a(scope, array);
@@ -669,7 +661,6 @@ QVariant SequencePrototype::toVariant(const QV4::Value &array, QMetaType typeHin
return result;
}
- *succeeded = false;
return QVariant();
}