diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-27 08:32:44 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-30 08:05:43 +0200 |
commit | 472c8e6bed0b18c4e853c905ace07a09c64c29d2 (patch) | |
tree | fda473b78c3acd03f1681e99e288be42e5b9f574 /src/qml/jsruntime/qv4sequenceobject.cpp | |
parent | aacebc74b2d6d982caa4ba0952fd848ffdc54c7a (diff) |
Remove some more QV4::Value usages
Change-Id: Ic146a964f2ff6b90eeceda90bf1834d7212386a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4sequenceobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 5c3204d5fc..f9e1c400e1 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -347,25 +347,25 @@ public: struct CompareFunctor { - CompareFunctor(QV4::ExecutionContext *ctx, const QV4::Value &compareFn) + CompareFunctor(QV4::ExecutionContext *ctx, const QV4::ValueRef compareFn) : m_ctx(ctx), m_compareFn(compareFn) {} bool operator()(typename Container::value_type lhs, typename Container::value_type rhs) { - QV4::Managed *fun = this->m_compareFn.asManaged(); - Scope scope(fun->engine()); + QV4::Scope scope(m_ctx); + ScopedObject compare(scope, m_compareFn); ScopedCallData callData(scope, 2); callData->args[0] = convertElementToValue(this->m_ctx->engine, lhs); callData->args[1] = convertElementToValue(this->m_ctx->engine, rhs); - callData->thisObject = QV4::Value::fromObject(this->m_ctx->engine->globalObject); - QV4::ScopedValue result(scope, fun->call(callData)); + callData->thisObject = this->m_ctx->engine->globalObject; + QV4::ScopedValue result(scope, compare->call(callData)); return result->toNumber() < 0; } private: QV4::ExecutionContext *m_ctx; - QV4::Value m_compareFn; + QV4::ValueRef m_compareFn; }; void sort(QV4::SimpleCallContext *ctx) @@ -376,9 +376,9 @@ public: loadReference(); } + QV4::Scope scope(ctx); if (ctx->callData->argc == 1 && ctx->callData->args[0].asFunctionObject()) { - QV4::Value compareFn = ctx->callData->args[0]; - CompareFunctor cf(ctx, compareFn); + CompareFunctor cf(ctx, ctx->callData->args[0]); std::sort(m_container.begin(), m_container.end(), cf); } else { DefaultCompareFunctor cf; @@ -648,7 +648,7 @@ QVariant SequencePrototype::toVariant(const QV4::ValueRef array, int typeHint, b return qMetaTypeId<SequenceType>(); \ } else -int SequencePrototype::metaTypeForSequence(QV4::Object *object) +int SequencePrototype::metaTypeForSequence(QV4::ObjectRef object) { FOREACH_QML_SEQUENCE_TYPE(MAP_META_TYPE) /*else*/ { |