AutoTest: Avoid invalid parse results

If the document gets updated while typing we can get different
results when fetching the content and using positions inside the
content which might have updated milliseconds later.
Beside fetching only once ensure valid parse results by adding an
additional check for the used visitor.

Change-Id: Id1ba4a139a4dc497be0fbb5cf1f81004f3f8676c
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Christian Stenger
2016-03-31 14:31:53 +02:00
parent 2ce3bf8ed4
commit 01504e41b8
3 changed files with 15 additions and 7 deletions

View File

@@ -52,6 +52,7 @@ public:
virtual ~TestVisitor();
QMap<QString, TestCodeLocationAndType> privateSlots() const { return m_privSlots; }
bool resultValid() const { return m_valid; }
bool visit(CPlusPlus::Class *symbol);
@@ -59,6 +60,7 @@ private:
CppTools::SymbolFinder m_symbolFinder;
QString m_className;
QMap<QString, TestCodeLocationAndType> m_privSlots;
bool m_valid = false;
};
class TestAstVisitor : public CPlusPlus::ASTVisitor