diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2023-01-31 16:02:26 +0100 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2023-02-01 09:48:12 +0000 |
commit | 0198ed15f34c15b906d752f1025ebcb6ffe11c57 (patch) | |
tree | 73b25d93aee31a551efa1a0e31c3fd44929efe3c | |
parent | 4108ba874a18b0ee4346eb2e21f370f1f027a0ad (diff) | |
download | qt-creator-0198ed15f34c15b906d752f1025ebcb6ffe11c57.tar.gz |
QmlDesigner: Skip makeComponentChain in TextToModelMerger::load
This is not required in the context of QmlDesigner and can become
very slow.
Change-Id: Id4a4ae30c5fa55e88ed295624365efb724e26f62
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r-- | src/libs/qmljs/qmljsscopechain.cpp | 10 | ||||
-rw-r--r-- | src/libs/qmljs/qmljsscopechain.h | 4 | ||||
-rw-r--r-- | src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/libs/qmljs/qmljsscopechain.cpp b/src/libs/qmljs/qmljsscopechain.cpp index 5ba80fd713..e2f24a7839 100644 --- a/src/libs/qmljs/qmljsscopechain.cpp +++ b/src/libs/qmljs/qmljsscopechain.cpp @@ -11,6 +11,8 @@ using namespace QmlJS; +bool ScopeChain::s_setSkipmakeComponentChain = false; + /*! \class QmlJS::ScopeChain \brief The ScopeChain class describes the scopes used for global lookup in @@ -210,6 +212,11 @@ QList<const ObjectValue *> ScopeChain::all() const return m_all; } +void ScopeChain::setSkipmakeComponentChain(bool b) +{ + s_setSkipmakeComponentChain = b; +} + static void collectScopes(const QmlComponentChain *chain, QList<const ObjectValue *> *target) { foreach (const QmlComponentChain *parent, chain->instantiatingComponents()) @@ -351,6 +358,9 @@ void ScopeChain::makeComponentChain( const Snapshot &snapshot, QHash<const Document *, QmlComponentChain *> *components) { + if (s_setSkipmakeComponentChain) + return; + Document::Ptr doc = target->document(); if (!doc->qmlProgram()) return; diff --git a/src/libs/qmljs/qmljsscopechain.h b/src/libs/qmljs/qmljsscopechain.h index f3b8ae2bb5..88d7772b67 100644 --- a/src/libs/qmljs/qmljsscopechain.h +++ b/src/libs/qmljs/qmljsscopechain.h @@ -77,6 +77,8 @@ public: QList<const ObjectValue *> all() const; + static void setSkipmakeComponentChain(bool b); + private: void update() const; void initializeRootScope(); @@ -97,6 +99,8 @@ private: mutable bool m_modified; mutable QList<const ObjectValue *> m_all; + + static bool s_setSkipmakeComponentChain; }; } // namespace QmlJS diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index bb7bbb16c0..a4fd078b76 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -1092,6 +1092,9 @@ Document::MutablePtr TextToModelMerger::createParsedDocument(const QUrl &url, co bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceHandler) { + QmlJS::ScopeChain::setSkipmakeComponentChain(true); + QScopeGuard unSkip([]() { QmlJS::ScopeChain::setSkipmakeComponentChain(false); }); + qCInfo(rewriterBenchmark) << Q_FUNC_INFO; const bool justSanityCheck = !differenceHandler.isAmender(); |