aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvme.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-05-22 14:30:57 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-05-22 15:50:11 +0200
commita12cc118ddce1615425ddf12296584d34acf57cc (patch)
tree342e2a8a5cad4594bc177a2d93b9c06873bff45a /src/qml/qml/qqmlvme.cpp
parent54d8facf66d668d8cea1184f7f24928e97497ae1 (diff)
Replace usage of v8::Script and qmlModeCompile with QV4::Script
Change-Id: I114a0b7faed39be313cde5617a0ce4a06dece7e2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r--src/qml/qml/qqmlvme.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 541176c3c7..d291452b49 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -1164,14 +1164,19 @@ void QQmlScriptData::initialize(QQmlEngine *engine)
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
QV8Engine *v8engine = ep->v8engine();
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8engine);
// If compilation throws an error, a surrounding catch will record it.
- v8::Handle<v8::Script> program = v8engine->qmlModeCompile(m_programSource.constData(),
- m_programSource.length(), urlString, 1);
- if (program.IsEmpty())
- return;
+ // pass 0 as the QML object, we set it later before calling run()
+ QV4::Script *program = new QV4::Script(v4, 0, m_programSource, urlString, 1);
+ try {
+ program->parse();
+ } catch (QV4::Exception &) {
+ delete program;
+ throw;
+ }
- m_program = program.get();
+ m_program = program;
m_programSource.clear(); // We don't need this anymore
addToEngine(engine);
@@ -1238,12 +1243,16 @@ QV4::PersistentValue QQmlVME::run(QQmlContextData *parentCtxt, QQmlScriptData *s
if (!script->isInitialized())
script->initialize(parentCtxt->engine);
+ if (!script->m_program)
+ return QV4::PersistentValue();
+
v8::Handle<v8::Object> qmlglobal = v8engine->qmlScope(ctxt, 0);
v8engine->contextWrapper()->takeContextOwnership(qmlglobal);
QV4::ExecutionContext *ctx = QV8Engine::getV4(v8engine)->current;
try {
- script->m_program->Run(qmlglobal);
+ script->m_program->qml = qmlglobal->v4Value().asObject();
+ script->m_program->run();
} catch (QV4::Exception &e) {
e.accept(ctx);
QQmlError error;