diff options
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4arrayobject.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index a8bc774e29..1628cfe4da 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -174,12 +174,22 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx) } ScopedArrayObject elt(scope); + ScopedObject eltAsObj(scope); + ScopedValue entry(scope); for (int i = 0; i < ctx->callData->argc; ++i) { + eltAsObj = ctx->callData->args[i]; elt = ctx->callData->args[i]; - if (elt) + if (elt) { result->arrayConcat(elt.getPointer()); - else + } else if (eltAsObj && eltAsObj->isListType()) { + const uint startIndex = getLength(ctx, result); + for (int i = 0, len = getLength(ctx, eltAsObj); i < len; ++i) { + entry = eltAsObj->getIndexed(i); + result->putIndexed(startIndex + i, entry); + } + } else { result->arraySet(getLength(ctx, result), ctx->callData->args[i]); + } } return result.asReturnedValue(); |