Commit 8caff494 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Simplify Process.

parent dca2e821
...@@ -270,44 +270,43 @@ class Process: public std::unary_function<Document::Ptr, void> ...@@ -270,44 +270,43 @@ class Process: public std::unary_function<Document::Ptr, void>
{ {
QPointer<CppModelManager> _modelManager; QPointer<CppModelManager> _modelManager;
Snapshot _snapshot; Snapshot _snapshot;
CppModelManager::WorkingCopy _workingCopy;
Document::Ptr _doc; Document::Ptr _doc;
Document::CheckMode _mode;
public: public:
Process(QPointer<CppModelManager> modelManager, Process(QPointer<CppModelManager> modelManager,
Snapshot snapshot, Document::Ptr doc,
const Snapshot &snapshot,
const CppModelManager::WorkingCopy &workingCopy) const CppModelManager::WorkingCopy &workingCopy)
: _modelManager(modelManager), : _modelManager(modelManager),
_snapshot(snapshot), _snapshot(snapshot),
_workingCopy(workingCopy) _doc(doc),
{ } _mode(Document::FastCheck)
void operator()(Document::Ptr doc)
{ {
_doc = doc;
Document::CheckMode mode = Document::FastCheck;
if (_workingCopy.contains(doc->fileName())) if (workingCopy.contains(_doc->fileName()))
mode = Document::FullCheck; _mode = Document::FullCheck;
}
doc->check(mode); void operator()()
{
_doc->check(_mode);
if (mode == Document::FullCheck) { if (_mode == Document::FullCheck) {
// run the binding pass // run the binding pass
NamespaceBindingPtr ns = bind(doc, _snapshot); NamespaceBindingPtr ns = bind(_doc, _snapshot);
// check for undefined symbols. // check for undefined symbols.
CheckUndefinedSymbols checkUndefinedSymbols(doc); CheckUndefinedSymbols checkUndefinedSymbols(_doc);
checkUndefinedSymbols.setGlobalNamespaceBinding(ns); checkUndefinedSymbols.setGlobalNamespaceBinding(ns);
checkUndefinedSymbols(doc->translationUnit()->ast()); // ### FIXME checkUndefinedSymbols(_doc->translationUnit()->ast()); // ### FIXME
} }
doc->releaseTranslationUnit(); _doc->releaseTranslationUnit();
if (_modelManager) if (_modelManager)
_modelManager->emitDocumentUpdated(doc); // ### TODO: compress _modelManager->emitDocumentUpdated(_doc); // ### TODO: compress
} }
}; };
} // end of anonymous namespace } // end of anonymous namespace
...@@ -600,9 +599,9 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, unsigned ...@@ -600,9 +599,9 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, unsigned
m_todo.remove(fileName); m_todo.remove(fileName);
#ifndef ICHECK_BUILD #ifndef ICHECK_BUILD
Process process(m_modelManager, snapshot, m_workingCopy); Process process(m_modelManager, doc, snapshot, m_workingCopy);
process(doc); process();
(void) switchDocument(previousDoc); (void) switchDocument(previousDoc);
#else #else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment