Commit 205e0368 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Don't process already visited nodes.

parent 46a7ac5f
......@@ -59,6 +59,7 @@ void FindUsages::setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBi
QList<int> FindUsages::operator()(Symbol *symbol, Identifier *id, AST *ast)
{
_processed.clear();
_references.clear();
_declSymbol = symbol;
_id = id;
......@@ -92,6 +93,9 @@ QString FindUsages::matchingLine(const Token &tk) const
void FindUsages::reportResult(unsigned tokenIndex, const QList<Symbol *> &candidates)
{
if (_processed.contains(tokenIndex))
return;
const bool isStrongResult = checkCandidates(candidates);
if (isStrongResult)
......@@ -100,6 +104,11 @@ void FindUsages::reportResult(unsigned tokenIndex, const QList<Symbol *> &candid
void FindUsages::reportResult(unsigned tokenIndex)
{
if (_processed.contains(tokenIndex))
return;
_processed.insert(tokenIndex);
const Token &tk = tokenAt(tokenIndex);
const QString lineText = matchingLine(tk);
......
......@@ -114,6 +114,7 @@ private:
QList<int> _references;
LookupContext _previousContext;
int _inSimpleDeclaration;
QSet<unsigned> _processed;
};
} // 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