Delay the parsing of the document.

This commit is contained in:
Roberto Raggi
2009-09-30 16:13:43 +02:00
parent ace380ec28
commit 8356d3360b
4 changed files with 8 additions and 1 deletions

View File

@@ -390,6 +390,9 @@ void Document::check(CheckMode mode)
{
Q_ASSERT(!_globalNamespace);
if (! isParsed())
parse();
Semantic semantic(_control);
if (mode == FastCheck)
semantic.setSkipFunctionBodies(true);
@@ -450,7 +453,6 @@ Document::Ptr Snapshot::documentFromSource(const QByteArray &preprocessedCode,
}
newDoc->setSource(preprocessedCode);
newDoc->parse();
return newDoc;
}

View File

@@ -288,6 +288,7 @@ static void semanticSearch_helper(QFutureInterface<Core::Utils::FileSearchResult
}
Document::Ptr newDoc = snapshot.documentFromSource(source, fileName);
newDoc->parse();
if (SemanticSearch *search = factory->create(future, newDoc, snapshot)) {
search->setSource(source);

View File

@@ -412,6 +412,8 @@ void CppEditorSupport::checkDocumentNow()
const QByteArray preprocessedCode = snapshot.preprocessedCode(plainText, fileName);
if (Document::Ptr doc = snapshot.documentFromSource(preprocessedCode, fileName)) {
doc->parse();
CheckDocument checkDocument(doc, snapshot);
QList<QuickFixOperationPtr> quickFixes = checkDocument(ed->textCursor());
if (! quickFixes.isEmpty()) {

View File

@@ -255,6 +255,8 @@ bool TranslationUnit::parse(ParseMode mode)
if (! isTokenized())
tokenize();
f._parsed = true;
Parser parser(this);
parser.setQtMocRunEnabled(f._qtMocRunEnabled);
parser.setObjCEnabled(f._objCEnabled);