QmlJS: Move ensuredGetDocumentForPath to ModelManagerInterface

The new function does properly update the latest snapshot.

Change-Id: If3148701e2f98c39a0822d1395b43f4fa7ee1949
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
Thomas Hartmann
2014-06-26 13:52:36 +02:00
committed by Fawzi Mohamed
parent bafe7dbb0b
commit 2aa7df6dff
3 changed files with 18 additions and 12 deletions

View File

@@ -1379,6 +1379,19 @@ void ModelManagerInterface::joinAllThreads()
future.waitForFinished();
}
Document::Ptr ModelManagerInterface::ensuredGetDocumentForPath(const QString &filePath)
{
QmlJS::Document::Ptr document = newestSnapshot().document(filePath);
if (!document) {
document = QmlJS::Document::create(filePath, QmlJS::Language::Qml);
QMutexLocker lock(&m_mutex);
m_newestSnapshot.insert(document);
}
return document;
}
void ModelManagerInterface::resetCodeModel()
{
QStringList documents;