aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4script.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/qv4script.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/qv4script.cpp')
-rw-r--r--src/qml/jsruntime/qv4script.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 64dce24c05..0441c3cce6 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -204,12 +204,12 @@ void Script::parse()
v4->current->throwError(QV4::Value::fromObject(v4->newSyntaxErrorObject("Syntax error")));
}
-Value Script::run()
+ReturnedValue Script::run()
{
if (!parsed)
parse();
if (!vmFunction)
- return Value::undefinedValue();
+ return Encode::undefined();
QV4::ExecutionEngine *engine = scope->engine;
QV4::Scope valueScope(engine);
@@ -246,13 +246,13 @@ Value Script::run()
scope->compiledFunction = oldCompiledFunction;
scope->runtimeStrings = oldRuntimeStrings;
- return result;
+ return result.asReturnedValue();
} else {
FunctionObject *f = new (engine->memoryManager) QmlBindingWrapper(scope, vmFunction, qml.value().asObject());
ScopedCallData callData(valueScope, 0);
callData->thisObject = Value::undefinedValue();
- return Value::fromReturnedValue(f->call(callData));
+ return f->call(callData);
}
}
@@ -271,17 +271,17 @@ Value Script::qmlBinding()
return Value::fromObject(new (v4->memoryManager) QmlBindingWrapper(scope, vmFunction, qml.value().asObject()));
}
-QV4::Value Script::evaluate(ExecutionEngine *engine, const QString &script, Object *scopeObject)
+QV4::ReturnedValue Script::evaluate(ExecutionEngine *engine, const QString &script, Object *scopeObject)
{
+ QV4::Scope scope(engine);
QV4::Script qmlScript(engine, scopeObject, script, QString());
QV4::ExecutionContext *ctx = engine->current;
- QV4::Value result = QV4::Value::undefinedValue();
try {
qmlScript.parse();
- result = qmlScript.run();
+ return qmlScript.run();
} catch (QV4::Exception &e) {
e.accept(ctx);
}
- return result;
+ return Encode::undefined();
}