summaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4script_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-08-20 22:02:11 +0200
committerLars Knoll <lars.knoll@theqtcompany.com>2015-09-09 14:28:31 +0000
commit1079dbbdd96c517eed3269e4a5e18f18a6808be0 (patch)
tree6e0aa988e2996196701c5728323b86ea49f5074d /src/qml/jsruntime/qv4script_p.h
parent08a7ae47c24c1378cb39d0c796fcc37cc0c62b32 (diff)
Pass a QmlContext to QV4::Script instead of a contextwrapper
Change-Id: Ia8db166aacbbe6e8f588179dffa04e2dce9566cb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4script_p.h')
-rw-r--r--src/qml/jsruntime/qv4script_p.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h
index 5b92749b4c..63e8239342 100644
--- a/src/qml/jsruntime/qv4script_p.h
+++ b/src/qml/jsruntime/qv4script_p.h
@@ -36,6 +36,7 @@
#include "qv4global_p.h"
#include "qv4engine_p.h"
#include "qv4functionobject_p.h"
+#include "qv4context_p.h"
#include <QQmlError>
@@ -90,11 +91,14 @@ struct Q_QML_EXPORT Script {
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
, scope(scope), strictMode(false), inheritContext(false), parsed(false)
, vmFunction(0), parseAsBinding(false) {}
- Script(ExecutionEngine *engine, Object *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
+ Script(ExecutionEngine *engine, QmlContext *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
, scope(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false)
- , qml(engine, qml), vmFunction(0), parseAsBinding(true) {}
- Script(ExecutionEngine *engine, Object *qml, CompiledData::CompilationUnit *compilationUnit);
+ , vmFunction(0), parseAsBinding(true) {
+ if (qml)
+ qmlContext.set(engine, *qml);
+ }
+ Script(ExecutionEngine *engine, QmlContext *qml, CompiledData::CompilationUnit *compilationUnit);
~Script();
QString sourceFile;
int line;
@@ -104,7 +108,7 @@ struct Q_QML_EXPORT Script {
bool strictMode;
bool inheritContext;
bool parsed;
- QV4::PersistentValue qml;
+ QV4::PersistentValue qmlContext;
QV4::PersistentValue compilationUnitHolder;
Function *vmFunction;
bool parseAsBinding;
@@ -118,7 +122,7 @@ struct Q_QML_EXPORT Script {
static QQmlRefPointer<CompiledData::CompilationUnit> precompile(IR::Module *module, Compiler::JSUnitGenerator *unitGenerator, ExecutionEngine *engine, const QUrl &url, const QString &source,
QList<QQmlError> *reportedErrors = 0, QQmlJS::Directives *directivesCollector = 0);
- static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, Object *scopeObject);
+ static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, QmlContext *qmlContext);
};
}