forked from qt-creator/qt-creator
Introduced Snapshot::simplified(doc)
This commit is contained in:
@@ -386,3 +386,25 @@ QSharedPointer<NamespaceBinding> Snapshot::globalNamespaceBinding(Document::Ptr
|
|||||||
{
|
{
|
||||||
return CPlusPlus::bind(doc, *this);
|
return CPlusPlus::bind(doc, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Snapshot Snapshot::simplified(Document::Ptr doc) const
|
||||||
|
{
|
||||||
|
Snapshot snapshot;
|
||||||
|
simplified_helper(doc, &snapshot);
|
||||||
|
return snapshot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Snapshot::simplified_helper(Document::Ptr doc, Snapshot *snapshot) const
|
||||||
|
{
|
||||||
|
if (! doc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (! snapshot->contains(doc->fileName())) {
|
||||||
|
snapshot->insert(doc);
|
||||||
|
|
||||||
|
foreach (const Document::Include &incl, doc->includes()) {
|
||||||
|
Document::Ptr includedDoc = value(incl.fileName());
|
||||||
|
simplified_helper(includedDoc, snapshot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -277,6 +277,8 @@ public:
|
|||||||
Snapshot();
|
Snapshot();
|
||||||
~Snapshot();
|
~Snapshot();
|
||||||
|
|
||||||
|
Snapshot simplified(Document::Ptr doc) const;
|
||||||
|
|
||||||
QByteArray preprocessedCode(const QString &source,
|
QByteArray preprocessedCode(const QString &source,
|
||||||
const QString &fileName) const;
|
const QString &fileName) const;
|
||||||
|
|
||||||
@@ -288,6 +290,9 @@ public:
|
|||||||
void insert(Document::Ptr doc);
|
void insert(Document::Ptr doc);
|
||||||
|
|
||||||
using _Base::insert;
|
using _Base::insert;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void simplified_helper(Document::Ptr doc, Snapshot *snapshot) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace CPlusPlus
|
} // end of namespace CPlusPlus
|
||||||
|
|||||||
@@ -1727,6 +1727,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source) const
|
|||||||
{
|
{
|
||||||
const QByteArray preprocessedCode = source.snapshot.preprocessedCode(source.code, source.fileName);
|
const QByteArray preprocessedCode = source.snapshot.preprocessedCode(source.code, source.fileName);
|
||||||
Document::Ptr doc = source.snapshot.documentFromSource(preprocessedCode, source.fileName);
|
Document::Ptr doc = source.snapshot.documentFromSource(preprocessedCode, source.fileName);
|
||||||
|
const Snapshot snapshot = source.snapshot.simplified(doc);
|
||||||
doc->check();
|
doc->check();
|
||||||
|
|
||||||
Control *control = doc->control();
|
Control *control = doc->control();
|
||||||
@@ -1741,6 +1742,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source) const
|
|||||||
|
|
||||||
SemanticInfo semanticInfo;
|
SemanticInfo semanticInfo;
|
||||||
semanticInfo.revision = source.revision;
|
semanticInfo.revision = source.revision;
|
||||||
|
semanticInfo.snapshot = snapshot;
|
||||||
semanticInfo.doc = doc;
|
semanticInfo.doc = doc;
|
||||||
semanticInfo.localUses = useTable.localUses;
|
semanticInfo.localUses = useTable.localUses;
|
||||||
semanticInfo.externalUses = useTable.externalUses;
|
semanticInfo.externalUses = useTable.externalUses;
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
int revision;
|
int revision;
|
||||||
|
CPlusPlus::Snapshot snapshot;
|
||||||
CPlusPlus::Document::Ptr doc;
|
CPlusPlus::Document::Ptr doc;
|
||||||
LocalUseMap localUses;
|
LocalUseMap localUses;
|
||||||
ExternalUseMap externalUses;
|
ExternalUseMap externalUses;
|
||||||
|
|||||||
Reference in New Issue
Block a user