diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2018-10-05 14:17:05 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2018-11-01 15:07:01 +0000 |
commit | 8b418d9be73dafd25c9c528127274a3573f1a7e1 (patch) | |
tree | f5901f8cf6e9a23caadbf5ba6fc4c3329b9823c7 /src/qml/jsruntime | |
parent | fd3cf7a45ad5abf269aecc63dc164d9bd0f1b407 (diff) |
Clone ContextType::Global as ContextType::ScriptImportedByQML
Add new enum value QV4::Compiler::ContextType::ScriptImportedByQML, which
behaves exactly the same as ContextType::Global. A follow-up patch will change
the behavior slightly.
Task-number: QTBUG-69408
Change-Id: I20d27804fd1433f2229704546bcd78a0ac108c01
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4script_p.h | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 070c048c8f..951675b468 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -174,7 +174,8 @@ Function *Script::function() QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(QV4::Compiler::Module *module, QQmlJS::Engine *jsEngine, Compiler::JSUnitGenerator *unitGenerator, const QString &fileName, const QString &finalUrl, const QString &source, - QList<QQmlError> *reportedErrors) + QList<QQmlError> *reportedErrors, + QV4::Compiler::ContextType contextType) { using namespace QV4::Compiler; using namespace QQmlJS::AST; @@ -201,7 +202,7 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(QV4::Compi Codegen cg(unitGenerator, /*strict mode*/false); cg.setUseFastLookups(false); - cg.generateFromProgram(fileName, finalUrl, source, program, module, ContextType::Global); + cg.generateFromProgram(fileName, finalUrl, source, program, module, contextType); errors = cg.qmlErrors(); if (!errors.isEmpty()) { if (reportedErrors) diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index e7189664e2..c138e4a538 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -103,7 +103,8 @@ struct Q_QML_EXPORT Script { static QQmlRefPointer<CompiledData::CompilationUnit> precompile(QV4::Compiler::Module *module, QQmlJS::Engine *jsEngine, Compiler::JSUnitGenerator *unitGenerator, const QString &fileName, const QString &finalUrl, const QString &source, - QList<QQmlError> *reportedErrors = nullptr); + QList<QQmlError> *reportedErrors = nullptr, + QV4::Compiler::ContextType contextType = QV4::Compiler::ContextType::Global); static Script *createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, const QUrl &originalUrl, QString *error); static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, QmlContext *qmlContext); |