diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-11-09 10:43:42 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2017-11-12 08:16:36 +0000 |
commit | fdfb34c84ba01114d34259cd88a2b84fa22eb610 (patch) | |
tree | 35ccd985d5627c62057e8f708b0b9cf7c261e38c /src | |
parent | 54f15f5df5cf545bf4d675ccbafecd482b4a2b0b (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>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 10 |
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(); } |