aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-14 11:25:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 13:14:13 +0200
commitf79df5da0769836bc866b470cdac43d6363dc7db (patch)
tree28deb1584b6c43dca92b39328bcf43099a92fcd6 /src/qml/jsruntime/qv4runtime.cpp
parente4e90923c93adfafb23c81be7359e8df2a500b4f (diff)
Convert more methods to return a Returned<>
Change-Id: If294c9c4f574824c308b63a11da1337226180105 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index d98087b6a4..f2c655f5fe 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -735,11 +735,12 @@ void __qmljs_set_element(ExecutionContext *ctx, const ValueRef object, const Val
ReturnedValue __qmljs_foreach_iterator_object(ExecutionContext *ctx, const ValueRef in)
{
- Object *o = 0;
+ Scope scope(ctx);
+ Scoped<Object> o(scope, (Object *)0);
if (!in->isNullOrUndefined())
- o = in->toObject(ctx);
- Object *it = ctx->engine->newForEachIteratorObject(ctx, o);
- return Value::fromObject(it).asReturnedValue();
+ o = in;
+ Scoped<Object> it(scope, ctx->engine->newForEachIteratorObject(ctx, o.getPointer()));
+ return it.asReturnedValue();
}
ReturnedValue __qmljs_foreach_next_property_name(const ValueRef foreach_iterator)
@@ -1161,7 +1162,8 @@ void __qmljs_builtin_define_property(ExecutionContext *ctx, const ValueRef objec
ReturnedValue __qmljs_builtin_define_array(ExecutionContext *ctx, Value *values, uint length)
{
- ArrayObject *a = ctx->engine->newArrayObject();
+ Scope scope(ctx);
+ Scoped<ArrayObject> a(scope, ctx->engine->newArrayObject());
// ### FIXME: We need to allocate the array data to avoid crashes other places
// This should rather be done when required
@@ -1181,7 +1183,7 @@ ReturnedValue __qmljs_builtin_define_array(ExecutionContext *ctx, Value *values,
}
a->setArrayLengthUnchecked(length);
}
- return Value::fromObject(a).asReturnedValue();
+ return a.asReturnedValue();
}
void __qmljs_builtin_define_getter_setter(ExecutionContext *ctx, const ValueRef object, String *name, const ValueRef getter, const ValueRef setter)