aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4sparsearray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4sparsearray.cpp')
-rw-r--r--src/qml/jsruntime/qv4sparsearray.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp
index 835a0d004f..5b720d2fef 100644
--- a/src/qml/jsruntime/qv4sparsearray.cpp
+++ b/src/qml/jsruntime/qv4sparsearray.cpp
@@ -43,6 +43,7 @@
#include "qv4runtime_p.h"
#include "qv4object_p.h"
#include "qv4functionobject_p.h"
+#include "qv4scopedvalue_p.h"
#include <stdlib.h>
#ifdef QT_QMAP_DEBUG
@@ -54,20 +55,21 @@ using namespace QV4;
bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) const
{
- Value v1 = p1.value;
- Value v2 = p2.value;
- if (v1.isUndefined())
+ if (p1.value.isUndefined())
return false;
- if (v2.isUndefined())
+ if (p2.value.isUndefined())
return true;
- if (!m_comparefn.isUndefined()) {
- Value args[] = { v1, v2 };
+ if (Object *o = m_comparefn.asObject()) {
+ ScopedCallData callData(o->engine(), 2);
+ callData->thisObject = Value::undefinedValue();
+ callData->args[0] = p1.value;
+ callData->args[1] = p2.value;
Value result = Value::undefinedValue();
- __qmljs_call_value(m_context, &result, /*thisObject*/0, m_comparefn, args, 2);
+ __qmljs_call_value(m_context, &result, m_comparefn, callData.ptr);
return result.toNumber() <= 0;
}
- return v1.toString(m_context)->toQString() < v2.toString(m_context)->toQString();
+ return p1.value.toString(m_context)->toQString() < p2.value.toString(m_context)->toQString();
}