AutoTest: Turn global variable into attribute

Change-Id: Id45bafa61f03e8225d5f4224611e2f6db84a16b1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Bernhard Beschow
2021-01-01 19:18:40 +01:00
parent d3595110f1
commit 43706c0b65
2 changed files with 10 additions and 10 deletions

View File

@@ -169,10 +169,6 @@ void TestCodeParser::updateTestTree(const QSet<ITestFramework *> &frameworks)
scanForTests(QStringList(), sortedFrameworks); scanForTests(QStringList(), sortedFrameworks);
} }
// used internally to indicate a parse that failed due to having triggered a parse for a file that
// is not (yet) part of the CppModelManager's snapshot
static bool parsingHasFailed;
/****** threaded parsing stuff *******/ /****** threaded parsing stuff *******/
void TestCodeParser::onDocumentUpdated(const QString &fileName, bool isQmlFile) void TestCodeParser::onDocumentUpdated(const QString &fileName, bool isQmlFile)
@@ -333,7 +329,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList, const QList<ITest
m_parserState = PartialParse; m_parserState = PartialParse;
} }
parsingHasFailed = false; m_parsingHasFailed = false;
TestTreeModel::instance()->updateCheckStateCache(); TestTreeModel::instance()->updateCheckStateCache();
if (isFullParse) { if (isFullParse) {
// remove qml files as they will be found automatically by the referencing cpp file // remove qml files as they will be found automatically by the referencing cpp file
@@ -392,7 +388,7 @@ void TestCodeParser::onTaskStarted(Utils::Id type)
m_fullUpdatePostponed = m_parserState == FullParse; m_fullUpdatePostponed = m_parserState == FullParse;
m_partialUpdatePostponed = !m_fullUpdatePostponed; m_partialUpdatePostponed = !m_fullUpdatePostponed;
qCDebug(LOG) << "Canceling scan for test (CppModelParsing started)"; qCDebug(LOG) << "Canceling scan for test (CppModelParsing started)";
parsingHasFailed = true; m_parsingHasFailed = true;
Core::ProgressManager::cancelTasks(Constants::TASK_PARSE); Core::ProgressManager::cancelTasks(Constants::TASK_PARSE);
} }
} }
@@ -401,7 +397,7 @@ void TestCodeParser::onTaskStarted(Utils::Id type)
void TestCodeParser::onAllTasksFinished(Utils::Id type) void TestCodeParser::onAllTasksFinished(Utils::Id type)
{ {
// if we cancel parsing ensure that progress animation is canceled as well // if we cancel parsing ensure that progress animation is canceled as well
if (type == Constants::TASK_PARSE && parsingHasFailed) if (type == Constants::TASK_PARSE && m_parsingHasFailed)
emit parsingFailed(); emit parsingFailed();
// only CPP parsing is relevant as we trigger Qml parsing internally anyway // only CPP parsing is relevant as we trigger Qml parsing internally anyway
@@ -416,7 +412,7 @@ void TestCodeParser::onAllTasksFinished(Utils::Id type)
void TestCodeParser::onFinished() void TestCodeParser::onFinished()
{ {
if (m_futureWatcher.isCanceled()) if (m_futureWatcher.isCanceled())
parsingHasFailed = true; m_parsingHasFailed = true;
switch (m_parserState) { switch (m_parserState) {
case PartialParse: case PartialParse:
qCDebug(LOG) << "setting state to Idle (onFinished, PartialParse)"; qCDebug(LOG) << "setting state to Idle (onFinished, PartialParse)";
@@ -427,8 +423,8 @@ void TestCodeParser::onFinished()
case FullParse: case FullParse:
qCDebug(LOG) << "setting state to Idle (onFinished, FullParse)"; qCDebug(LOG) << "setting state to Idle (onFinished, FullParse)";
m_parserState = Idle; m_parserState = Idle;
m_dirty = parsingHasFailed; m_dirty = m_parsingHasFailed;
if (m_partialUpdatePostponed || m_fullUpdatePostponed || parsingHasFailed) { if (m_partialUpdatePostponed || m_fullUpdatePostponed || m_parsingHasFailed) {
onPartialParsingFinished(); onPartialParsingFinished();
} else { } else {
qCDebug(LOG) << "emitting parsingFinished" qCDebug(LOG) << "emitting parsingFinished"

View File

@@ -102,6 +102,10 @@ private:
void parsePostponedFiles(); void parsePostponedFiles();
void releaseParserInternals(); void releaseParserInternals();
// used internally to indicate a parse that failed due to having triggered a parse for a file that
// is not (yet) part of the CppModelManager's snapshot
bool m_parsingHasFailed = false;
bool m_codeModelParsing = false; bool m_codeModelParsing = false;
bool m_fullUpdatePostponed = false; bool m_fullUpdatePostponed = false;
bool m_partialUpdatePostponed = false; bool m_partialUpdatePostponed = false;