aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlirbuilder_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-05-11 15:39:04 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-05-11 19:18:45 +0000
commit0a2aaee61cfc2888bc71f54ac5b165d248cbf5e8 (patch)
tree9b30375af46c4b13ca1e0fccf8b7fe241200f936 /src/qml/compiler/qqmlirbuilder_p.h
parent2433fa45d75cf26add9e7f0ceb8ee439eba68753 (diff)
Fix .import within .js files with CONFIG+=qtquickcompiler
When loading a .js file without QQC, we scan the sources and use the ScriptDirectivesCollector to extract things like .pragma library or .import ahead of time. That information is passed on to the compilation unit generator for serialization. When compiling .js files ahead of time, we also used the same collector, but we forgot to save the data into the right location before serialization, so we essentially lost the imports. This patch fixes that by centralizing this code into the ScriptDirectivesCollector itself. [ChangeLog][QtQml] Fix regression with .import in .js files not working when using CONFIG+=qtquickcompiler. Change-Id: I5413c14b1b8bd3114a997011534fe55cdb7634aa Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder_p.h')
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index c2cf18e3c4..689b232b1c 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -462,14 +462,14 @@ struct Q_QML_PRIVATE_EXPORT Document
static void removeScriptPragmas(QString &script);
};
-struct Q_QML_PRIVATE_EXPORT ScriptDirectivesCollector : public QQmlJS::Directives
+class Q_QML_PRIVATE_EXPORT ScriptDirectivesCollector : public QQmlJS::Directives
{
- ScriptDirectivesCollector(QQmlJS::Engine *engine, QV4::Compiler::JSUnitGenerator *unitGenerator);
-
+ QmlIR::Document *document;
QQmlJS::Engine *engine;
QV4::Compiler::JSUnitGenerator *jsGenerator;
- QList<const QV4::CompiledData::Import *> imports;
- bool hasPragmaLibrary;
+
+public:
+ ScriptDirectivesCollector(QmlIR::Document *doc);
void pragmaLibrary() override;
void importFile(const QString &jsfile, const QString &module, int lineNumber, int column) override;