From 0a2aaee61cfc2888bc71f54ac5b165d248cbf5e8 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 11 May 2018 15:39:04 +0200 Subject: 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 --- src/qml/qml/qqmltypeloader.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/qml/qml/qqmltypeloader.cpp') diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 9856a0be80..d7bd882356 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -3021,7 +3021,7 @@ void QQmlScriptBlob::dataReceived(const SourceCodeData &data) return; } - QmlIR::ScriptDirectivesCollector collector(&irUnit.jsParserEngine, &irUnit.jsGenerator); + QmlIR::ScriptDirectivesCollector collector(&irUnit); QList errors; QQmlRefPointer unit = QV4::Script::precompile( @@ -3037,9 +3037,6 @@ void QQmlScriptBlob::dataReceived(const SourceCodeData &data) unit.adopt(new QV4::CompiledData::CompilationUnit); } irUnit.javaScriptCompilationUnit = unit; - irUnit.imports = collector.imports; - if (collector.hasPragmaLibrary) - irUnit.jsModule.unitFlags |= QV4::CompiledData::Unit::IsSharedLibrary; QmlIR::QmlUnitGenerator qmlGenerator; QV4::CompiledData::Unit *unitData = qmlGenerator.generate(irUnit); -- cgit v1.2.3