aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4include.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-12 15:27:01 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 13:13:49 +0200
commitce5dee24226f6abacaffe298092afe035d0822c4 (patch)
tree3b4dca1f091e47fcc0a235983853613f2f342726 /src/qml/jsruntime/qv4include.cpp
parent16f92ad85cf665d863ded5eeaaa7fc3f90820b3f (diff)
Convert more methods to use ReturnedValue
Change Exception.value() and a few other places. Change-Id: I53ce17e5656e260138b1ac7f6d467e4636c0a0b9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4include.cpp')
-rw-r--r--src/qml/jsruntime/qv4include.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 3bbfc4a322..43e566b5fb 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -149,7 +149,8 @@ void QV4Include::finished()
QV4::Script script(v4, m_qmlglobal.value().asObject(), code, m_url.toString());
QV4::ExecutionContext *ctx = v4->current;
- QV4::Object *o = m_resultObject.value().asObject();
+ QV4::Scope scope(v4);
+ QV4::Scoped<QV4::Object> o(scope, m_resultObject.value());
try {
script.parse();
script.run();
@@ -157,7 +158,8 @@ void QV4Include::finished()
} catch (QV4::Exception &e) {
e.accept(ctx);
o->put(v4->newString("status"), QV4::Value::fromInt32(Exception));
- o->put(v4->newString("exception"), e.value());
+ QV4::ScopedValue ex(scope, e.value());
+ o->put(v4->newString("exception"), ex);
}
} else {
m_resultObject.value().asObject()->put(v4->newString("status"), QV4::Value::fromInt32(NetworkError));
@@ -178,6 +180,7 @@ QV4::ReturnedValue QV4Include::method_include(QV4::SimpleCallContext *ctx)
return QV4::Encode::undefined();
QV4::ExecutionEngine *v4 = ctx->engine;
+ QV4::Scope scope(v4);
QV8Engine *engine = v4->v8Engine;
QQmlContextData *context = QV4::QmlContextWrapper::callingContext(v4);
@@ -192,7 +195,7 @@ QV4::ReturnedValue QV4Include::method_include(QV4::SimpleCallContext *ctx)
QString localFile = QQmlFile::urlToLocalFileOrQrc(url);
- QV4::Value result = QV4::Value::undefinedValue();
+ QV4::ScopedValue result(scope);
if (localFile.isEmpty()) {
@@ -210,8 +213,8 @@ QV4::ReturnedValue QV4Include::method_include(QV4::SimpleCallContext *ctx)
QString code = QString::fromUtf8(data);
QQmlScript::Parser::extractPragmas(code);
- QV4::Object *qmlglobal = v4->qmlContextObject();
- QV4::Script script(v4, qmlglobal, code, url.toString());
+ QV4::Scoped<QV4::Object> qmlglobal(scope, QV4::Value::fromObject(v4->qmlContextObject()));
+ QV4::Script script(v4, qmlglobal.getPointer(), code, url.toString());
QV4::ExecutionContext *ctx = v4->current;
try {
@@ -221,7 +224,8 @@ QV4::ReturnedValue QV4Include::method_include(QV4::SimpleCallContext *ctx)
} catch (QV4::Exception &e) {
e.accept(ctx);
result = resultValue(v4, Exception);
- result.asObject()->put(v4->newString("exception"), e.value());
+ QV4::ScopedValue ex(scope, e.value());
+ result->asObject()->put(v4->newString("exception"), ex);
}
} else {
result = resultValue(v4, NetworkError);