forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
|
||||||
|
bool ScopeChain::s_setSkipmakeComponentChain = false;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QmlJS::ScopeChain
|
\class QmlJS::ScopeChain
|
||||||
\brief The ScopeChain class describes the scopes used for global lookup in
|
\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;
|
return m_all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScopeChain::setSkipmakeComponentChain(bool b)
|
||||||
|
{
|
||||||
|
s_setSkipmakeComponentChain = b;
|
||||||
|
}
|
||||||
|
|
||||||
static void collectScopes(const QmlComponentChain *chain, QList<const ObjectValue *> *target)
|
static void collectScopes(const QmlComponentChain *chain, QList<const ObjectValue *> *target)
|
||||||
{
|
{
|
||||||
foreach (const QmlComponentChain *parent, chain->instantiatingComponents())
|
foreach (const QmlComponentChain *parent, chain->instantiatingComponents())
|
||||||
@@ -351,6 +358,9 @@ void ScopeChain::makeComponentChain(
|
|||||||
const Snapshot &snapshot,
|
const Snapshot &snapshot,
|
||||||
QHash<const Document *, QmlComponentChain *> *components)
|
QHash<const Document *, QmlComponentChain *> *components)
|
||||||
{
|
{
|
||||||
|
if (s_setSkipmakeComponentChain)
|
||||||
|
return;
|
||||||
|
|
||||||
Document::Ptr doc = target->document();
|
Document::Ptr doc = target->document();
|
||||||
if (!doc->qmlProgram())
|
if (!doc->qmlProgram())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ public:
|
|||||||
|
|
||||||
QList<const ObjectValue *> all() const;
|
QList<const ObjectValue *> all() const;
|
||||||
|
|
||||||
|
static void setSkipmakeComponentChain(bool b);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update() const;
|
void update() const;
|
||||||
void initializeRootScope();
|
void initializeRootScope();
|
||||||
@@ -97,6 +99,8 @@ private:
|
|||||||
|
|
||||||
mutable bool m_modified;
|
mutable bool m_modified;
|
||||||
mutable QList<const ObjectValue *> m_all;
|
mutable QList<const ObjectValue *> m_all;
|
||||||
|
|
||||||
|
static bool s_setSkipmakeComponentChain;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlJS
|
} // namespace QmlJS
|
||||||
|
|||||||
@@ -1092,6 +1092,9 @@ Document::MutablePtr TextToModelMerger::createParsedDocument(const QUrl &url, co
|
|||||||
|
|
||||||
bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceHandler)
|
bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceHandler)
|
||||||
{
|
{
|
||||||
|
QmlJS::ScopeChain::setSkipmakeComponentChain(true);
|
||||||
|
QScopeGuard unSkip([]() { QmlJS::ScopeChain::setSkipmakeComponentChain(false); });
|
||||||
|
|
||||||
qCInfo(rewriterBenchmark) << Q_FUNC_INFO;
|
qCInfo(rewriterBenchmark) << Q_FUNC_INFO;
|
||||||
|
|
||||||
const bool justSanityCheck = !differenceHandler.isAmender();
|
const bool justSanityCheck = !differenceHandler.isAmender();
|
||||||
|
|||||||
Reference in New Issue
Block a user