aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4jsonobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-01-13 09:09:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-20 21:14:31 +0100
commitbf6191f090b326eb0776cd4e921ddb56c8daa8a9 (patch)
tree7e0b3084366aa35542f591d2ffcc0dc0c70efe75 /src/qml/jsruntime/qv4jsonobject.cpp
parent5c25379cd1889dc16187c0ec62f32d2b17a320cf (diff)
Add a SimpleArrayData class
This makes the ArrayData class 'pure virtual'. SimpleArrayData now contains the implementation of simple arrays. This makes the separation between simple and sparse arrays a lot cleaner. It also allows us to move len and offset from the base class into the SimpleArrayClass. This fixes some bugs where we accessed len for sparse arrays leading to some buggy behavior. Added a virtual length() method to ArrayData to query the highes used index in the Array. Change-Id: Iab2ba2a48ebe5b7031759eeb4ebe02b4d86233f0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index f40c765327..facc2da781 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -1057,10 +1057,8 @@ QV4::ReturnedValue JsonObject::fromJsonArray(ExecutionEngine *engine, const QJso
Scoped<ArrayObject> a(scope, engine->newArrayObject());
a->arrayReserve(size);
ScopedValue v(scope);
- for (int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++)
a->arrayData->put(i, (v = fromJsonValue(engine, array.at(i))));
- a->arrayData->setLength(i + 1);
- }
a->setArrayLengthUnchecked(size);
return a.asReturnedValue();
}