Commit 9318ff73 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Ensure the chunks are completed.

parent 0d163379
...@@ -268,6 +268,8 @@ CheckSymbols::CheckSymbols(Document::Ptr doc, const LookupContext &context) ...@@ -268,6 +268,8 @@ CheckSymbols::CheckSymbols(Document::Ptr doc, const LookupContext &context)
CollectTypes collectTypes(doc, context.snapshot()); CollectTypes collectTypes(doc, context.snapshot());
_potentialTypes = collectTypes.types(); _potentialTypes = collectTypes.types();
_scopes = collectTypes.scopes(); _scopes = collectTypes.scopes();
_flushRequested = false;
_flushLine = 0;
} }
CheckSymbols::~CheckSymbols() CheckSymbols::~CheckSymbols()
...@@ -473,10 +475,16 @@ void CheckSymbols::endVisit(TemplateDeclarationAST *) ...@@ -473,10 +475,16 @@ void CheckSymbols::endVisit(TemplateDeclarationAST *)
void CheckSymbols::addTypeUsage(const Use &use) void CheckSymbols::addTypeUsage(const Use &use)
{ {
_typeUsages.append(use); if (_typeUsages.size() >= 50) {
if (_flushRequested && use.line != _flushLine)
flush();
else if (! _flushRequested) {
_flushRequested = true;
_flushLine = use.line;
}
}
if (_typeUsages.size() == 50) _typeUsages.append(use);
flush();
} }
void CheckSymbols::addTypeUsage(ClassOrNamespace *b, NameAST *ast) void CheckSymbols::addTypeUsage(ClassOrNamespace *b, NameAST *ast)
...@@ -563,6 +571,9 @@ Scope *CheckSymbols::findScope(AST *ast) const ...@@ -563,6 +571,9 @@ Scope *CheckSymbols::findScope(AST *ast) const
void CheckSymbols::flush() void CheckSymbols::flush()
{ {
_flushRequested = false;
_flushLine = 0;
if (_typeUsages.isEmpty()) if (_typeUsages.isEmpty())
return; return;
......
...@@ -119,6 +119,8 @@ private: ...@@ -119,6 +119,8 @@ private:
QList<ScopedSymbol *> _scopes; QList<ScopedSymbol *> _scopes;
QList<TemplateDeclarationAST *> _templateDeclarationStack; QList<TemplateDeclarationAST *> _templateDeclarationStack;
QVector<Use> _typeUsages; QVector<Use> _typeUsages;
bool _flushRequested;
unsigned _flushLine;
}; };
} // end of namespace CPlusPlus } // end of namespace CPlusPlus
......
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