From 3d6b1089711227acc432c404729f8cb5a431d2cc Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 16 Mar 2017 07:41:25 +0100 Subject: [PATCH] AutoTest: Fix handling of subtyping TestCase again We need a more present snapshot when inspecting the AST of QML files we need to process. Due to handling all problematic accesses inside the QmlJS model by guarding it with mutexes it is no problem even when parsing multi threaded. The former fix collided with another patch and therefore went in without fixing the issue. Task-number: QTCREATORBUG-17787 Change-Id: I460bae4b09cdc9a0cd38bc3383fd593c3abdfaad Reviewed-by: Marco Benelli --- src/plugins/autotest/quick/quicktestparser.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp index f6b7cf78176..c3440ce15d2 100644 --- a/src/plugins/autotest/quick/quicktestparser.cpp +++ b/src/plugins/autotest/quick/quicktestparser.cpp @@ -165,7 +165,6 @@ static QList scanDirectoryForQuickTestQmlFiles(const QStri } static bool checkQmlDocumentForQuickTestCode(QFutureInterface futureInterface, - const QmlJS::Snapshot &snapshot, const QmlJS::Document::Ptr &qmlJSDoc, const Core::Id &id, const QString &proFile = QString()) @@ -174,6 +173,7 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterfaceast(); QTC_ASSERT(ast, return false); + QmlJS::Snapshot snapshot = QmlJS::ModelManagerInterface::instance()->snapshot(); TestQmlVisitor qmlVisitor(qmlJSDoc, snapshot); QmlJS::AST::Node::accept(ast, &qmlVisitor); if (!qmlVisitor.isValid()) @@ -212,7 +212,6 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface futureInterface, - const QmlJS::Snapshot &snapshot, CPlusPlus::Document::Ptr document, const Core::Id &id) { @@ -233,7 +232,7 @@ static bool handleQtQuickTest(QFutureInterface futureInterfa const QList qmlDocs = scanDirectoryForQuickTestQmlFiles(srcDir); bool result = false; for (const QmlJS::Document::Ptr &qmlJSDoc : qmlDocs) - result |= checkQmlDocumentForQuickTestCode(futureInterface, snapshot, qmlJSDoc, id, proFile); + result |= checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id, proFile); return result; } @@ -280,14 +279,14 @@ bool QuickTestParser::processDocument(QFutureInterface futur if (proFile.isEmpty()) return false; QmlJS::Document::Ptr qmlJSDoc = m_qmlSnapshot.document(fileName); - return checkQmlDocumentForQuickTestCode(futureInterface, m_qmlSnapshot, qmlJSDoc, id(), proFile); + return checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id(), proFile); } if (!m_cppSnapshot.contains(fileName) || !selectedForBuilding(fileName)) return false; CPlusPlus::Document::Ptr document = m_cppSnapshot.find(fileName).value(); if (!includesQtQuickTest(document, m_cppSnapshot)) return false; - return handleQtQuickTest(futureInterface, m_qmlSnapshot, document, id()); + return handleQtQuickTest(futureInterface, document, id()); } } // namespace Internal