aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-11-09 10:43:42 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2017-11-12 08:16:36 +0000
commitfdfb34c84ba01114d34259cd88a2b84fa22eb610 (patch)
tree35ccd985d5627c62057e8f708b0b9cf7c261e38c
parent54f15f5df5cf545bf4d675ccbafecd482b4a2b0b (diff)
Improve encapsulation of the the IR de-serialization from QtQuick Compiler
The code used by QQC to deserialize the IR requires setting the javaScriptCompilationUnit member in order to connect the generated C++ code. Knowledge of the QmlIR::Document data structure layout on the side of the generated code (thus application) has its downsides though (see referenced bug). We can avoid that dependency easily by doing the entire de-serialization on the QtQml library side. The old "API" (load member function) is still around until the qqc change is also in. Task-number: QTBUG-63474 Change-Id: I239838afacc71474c86114b5b05679ff36e4c2e2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/qml/qml/qqmltypeloader.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index d9d7c19312..842cf74887 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2409,7 +2409,15 @@ void QQmlTypeData::dataReceived(const SourceCodeData &data)
void QQmlTypeData::initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *unit)
{
m_document.reset(new QmlIR::Document(isDebugging()));
- unit->loadIR(m_document.data(), unit);
+ if (unit->loadIR) {
+ // old code path for older generated code
+ unit->loadIR(m_document.data(), unit);
+ } else {
+ // new code path
+ QmlIR::IRLoader loader(unit->qmlData, m_document.data());
+ loader.load();
+ m_document->javaScriptCompilationUnit.adopt(unit->createCompilationUnit());
+ }
continueLoadFromIR();
}