aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-19 12:43:12 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-22 01:06:20 +0200
commit49369e62b50a4f903a5b2fcbfbfbc1f6f2838e8e (patch)
tree4e37696f0ce7b022bdca5821e4faa51ae715a881 /src/qml
parentb03e545734ab22fca4b98253c451b08c29aaee7e (diff)
Fix some smaller spec incompliances in Array.concat
Change-Id: I4a2252ef590c0d48ba734f96c7478637e1ddfd07 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index ff4f4aa40e..5e2a7db9a1 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -159,23 +159,17 @@ ReturnedValue ArrayPrototype::method_concat(SimpleCallContext *ctx)
Scope scope(ctx);
Scoped<ArrayObject> result(scope, ctx->engine->newArrayObject());
- if (ArrayObject *instance = ctx->thisObject.asArrayObject()) {
- result->copyArrayData(instance);
- } else if (ctx->thisObject.isString()) {
- QString v = ctx->thisObject.stringValue()->toQString();
- result->arraySet(0, Value::fromString(ctx, v));
- } else if (ctx->thisObject.asStringObject()) {
- QString v = ctx->thisObject.toString(ctx)->toQString();
- result->arraySet(0, Value::fromString(ctx, v));
+ ScopedObject thisObject(scope, ctx->thisObject.toObject(ctx));
+ ScopedArrayObject instance(scope, thisObject);
+ if (instance) {
+ result->copyArrayData(instance.getPointer());
} else {
- Object *instance = ctx->thisObject.toObject(ctx);
- result->arraySet(0, Value::fromObject(instance));
+ result->arraySet(0, thisObject.asValue());
}
for (uint i = 0; i < ctx->argumentCount; ++i) {
if (ArrayObject *elt = ctx->arguments[i].asArrayObject())
result->arrayConcat(elt);
-
else
result->arraySet(getLength(ctx, result.getPointer()), ctx->arguments[i]);
}