Commit 8356d336 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Delay the parsing of the document.

parent ace380ec
...@@ -390,6 +390,9 @@ void Document::check(CheckMode mode) ...@@ -390,6 +390,9 @@ void Document::check(CheckMode mode)
{ {
Q_ASSERT(!_globalNamespace); Q_ASSERT(!_globalNamespace);
if (! isParsed())
parse();
Semantic semantic(_control); Semantic semantic(_control);
if (mode == FastCheck) if (mode == FastCheck)
semantic.setSkipFunctionBodies(true); semantic.setSkipFunctionBodies(true);
...@@ -450,7 +453,6 @@ Document::Ptr Snapshot::documentFromSource(const QByteArray &preprocessedCode, ...@@ -450,7 +453,6 @@ Document::Ptr Snapshot::documentFromSource(const QByteArray &preprocessedCode,
} }
newDoc->setSource(preprocessedCode); newDoc->setSource(preprocessedCode);
newDoc->parse();
return newDoc; return newDoc;
} }
......
...@@ -288,6 +288,7 @@ static void semanticSearch_helper(QFutureInterface<Core::Utils::FileSearchResult ...@@ -288,6 +288,7 @@ static void semanticSearch_helper(QFutureInterface<Core::Utils::FileSearchResult
} }
Document::Ptr newDoc = snapshot.documentFromSource(source, fileName); Document::Ptr newDoc = snapshot.documentFromSource(source, fileName);
newDoc->parse();
if (SemanticSearch *search = factory->create(future, newDoc, snapshot)) { if (SemanticSearch *search = factory->create(future, newDoc, snapshot)) {
search->setSource(source); search->setSource(source);
......
...@@ -412,6 +412,8 @@ void CppEditorSupport::checkDocumentNow() ...@@ -412,6 +412,8 @@ void CppEditorSupport::checkDocumentNow()
const QByteArray preprocessedCode = snapshot.preprocessedCode(plainText, fileName); const QByteArray preprocessedCode = snapshot.preprocessedCode(plainText, fileName);
if (Document::Ptr doc = snapshot.documentFromSource(preprocessedCode, fileName)) { if (Document::Ptr doc = snapshot.documentFromSource(preprocessedCode, fileName)) {
doc->parse();
CheckDocument checkDocument(doc, snapshot); CheckDocument checkDocument(doc, snapshot);
QList<QuickFixOperationPtr> quickFixes = checkDocument(ed->textCursor()); QList<QuickFixOperationPtr> quickFixes = checkDocument(ed->textCursor());
if (! quickFixes.isEmpty()) { if (! quickFixes.isEmpty()) {
......
...@@ -255,6 +255,8 @@ bool TranslationUnit::parse(ParseMode mode) ...@@ -255,6 +255,8 @@ bool TranslationUnit::parse(ParseMode mode)
if (! isTokenized()) if (! isTokenized())
tokenize(); tokenize();
f._parsed = true;
Parser parser(this); Parser parser(this);
parser.setQtMocRunEnabled(f._qtMocRunEnabled); parser.setQtMocRunEnabled(f._qtMocRunEnabled);
parser.setObjCEnabled(f._objCEnabled); parser.setObjCEnabled(f._objCEnabled);
......
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