Update internal cache / test tree only if necessary

This commit is contained in:
Christian Stenger
2014-11-06 12:12:39 +01:00
committed by Christian Stenger
parent 1258c58a7f
commit 85efa2c3c9
3 changed files with 24 additions and 19 deletions

View File

@@ -213,16 +213,19 @@ void TestCodeParser::checkDocumentForTestCode(CPlusPlus::Document::Ptr doc)
break;
}
}
info = m_cppDocMap.value(declFileName);
count = autoTestRootItem->childCount();
for (int i = 0; i < count; ++i) {
TestTreeItem *currentItem = autoTestRootItem->child(i);
if (currentItem->filePath() == declFileName) {
m_model->modifyAutoTestSubtree(i, ttItem);
TestInfo ti(tc, privSlots.keys(), doc->revision(), doc->editorRevision());
ti.setReferencingFile(file);
m_cppDocMap.insert(declFileName, ti);
break;
if (declFileName != file) {
info = m_cppDocMap.value(declFileName);
count = autoTestRootItem->childCount();
for (int i = 0; i < count; ++i) {
TestTreeItem *currentItem = autoTestRootItem->child(i);
if (currentItem->filePath() == declFileName) {
m_model->modifyAutoTestSubtree(i, ttItem);
TestInfo ti(tc, privSlots.keys(), doc->revision(),
doc->editorRevision());
ti.setReferencingFile(file);
m_cppDocMap.insert(declFileName, ti);
break;
}
}
}
delete ttItem;
@@ -230,9 +233,11 @@ void TestCodeParser::checkDocumentForTestCode(CPlusPlus::Document::Ptr doc)
m_model->addAutoTest(ttItem);
m_cppDocMap.insert(file, TestInfo(tc, privSlots.keys(), doc->revision(),
doc->editorRevision()));
TestInfo ti(tc, privSlots.keys(), doc->revision(), doc->editorRevision());
ti.setReferencingFile(file);
m_cppDocMap.insert(declFileName, ti);
if (declFileName != file) {
TestInfo ti(tc, privSlots.keys(), doc->revision(), doc->editorRevision());
ti.setReferencingFile(file);
m_cppDocMap.insert(declFileName, ti);
}
}
}
} else {