aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4arrayobject.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-30 02:59:43 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-09-30 03:38:12 +0000
commite4134cfd8086a78c61a46fdfb908ade27c8d9840 (patch)
tree9514153cd35f7335238b08586671445283abbef6 /src/qml/jsruntime/qv4arrayobject.cpp
parent0ca693407473eb9457cdf8f9d4be32c9d4968ced (diff)
parent0bf14044178d7aa212ac7e28530f9077790a3df4 (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src/qml/jsruntime/qv4arrayobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 3521673461..555eb964c1 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -184,6 +184,10 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
{
Scope scope(ctx);
ScopedValue arg(scope, ctx->argument(0));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
+
+ if (!instance)
+ return ctx->d()->engine->newString()->asReturnedValue();
QString r4;
if (arg->isUndefined())
@@ -191,8 +195,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
else
r4 = arg->toQString();
- ScopedObject self(scope, ctx->thisObject());
- ScopedValue length(scope, self->get(ctx->d()->engine->id_length()));
+ ScopedValue length(scope, instance->get(ctx->d()->engine->id_length()));
const quint32 r2 = length->isUndefined() ? 0 : length->toUInt32();
if (!r2)
@@ -201,7 +204,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
QString R;
// ### FIXME
- if (ArrayObject *a = self->as<ArrayObject>()) {
+ if (ArrayObject *a = instance->as<ArrayObject>()) {
ScopedValue e(scope);
for (uint i = 0; i < a->getLength(); ++i) {
if (i)
@@ -218,7 +221,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
// crazy!
//
ScopedString name(scope, ctx->d()->engine->newString(QStringLiteral("0")));
- ScopedValue r6(scope, self->get(name));
+ ScopedValue r6(scope, instance->get(name));
if (!r6->isNullOrUndefined())
R = r6->toQString();
@@ -227,7 +230,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
R += r4;
name = Primitive::fromDouble(k).toString(scope.engine);
- r12 = self->get(name);
+ r12 = instance->get(name);
if (scope.hasException())
return Encode::undefined();