From ce5dee24226f6abacaffe298092afe035d0822c4 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 12 Sep 2013 15:27:01 +0200 Subject: Convert more methods to use ReturnedValue Change Exception.value() and a few other places. Change-Id: I53ce17e5656e260138b1ac7f6d467e4636c0a0b9 Reviewed-by: Simon Hausmann --- src/qml/jsapi/qjsvalue.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/qml/jsapi/qjsvalue.cpp') diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index dabb9f5b29..e596cb6303 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -807,13 +807,14 @@ QJSValue QJSValue::property(const QString& name) const s->makeIdentifier(); QV4::ExecutionContext *ctx = engine->current; + QV4::ScopedValue result(scope); try { - QV4::ScopedValue v(scope, o->get(s)); - return new QJSValuePrivate(engine, v); + result = o->get(s); } catch (QV4::Exception &e) { e.accept(ctx); - return new QJSValuePrivate(engine, e.value()); + result = e.value(); } + return new QJSValuePrivate(engine, result); } /*! @@ -840,13 +841,14 @@ QJSValue QJSValue::property(quint32 arrayIndex) const return QJSValue(); QV4::ExecutionContext *ctx = engine->current; + QV4::ScopedValue result(scope); try { - QV4::ScopedValue v(scope, arrayIndex == UINT_MAX ? o->get(engine->id_uintMax) : o->getIndexed(arrayIndex)); - return new QJSValuePrivate(engine, v); + result = arrayIndex == UINT_MAX ? o->get(engine->id_uintMax) : o->getIndexed(arrayIndex); } catch (QV4::Exception &e) { e.accept(ctx); - return new QJSValuePrivate(engine, e.value()); + result = e.value(); } + return new QJSValuePrivate(engine, result); } /*! -- cgit v1.2.3