forked from qt-creator/qt-creator
Merge commit 'origin/1.3'
Conflicts: src/plugins/qt4projectmanager/qt4project.cpp
This commit is contained in:
@@ -152,6 +152,25 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
|
||||
if (processed->contains(this))
|
||||
return 0;
|
||||
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId()) {
|
||||
Binding *current = this;
|
||||
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
Identifier *nameId = q->nameAt(i)->identifier();
|
||||
if (! nameId)
|
||||
return 0;
|
||||
|
||||
QSet<Binding *> visited;
|
||||
Binding *binding = current->findClassOrNamespaceBinding(nameId, &visited); // ### TODO: check recursion.
|
||||
if (! binding)
|
||||
return 0;
|
||||
|
||||
current = binding;
|
||||
}
|
||||
|
||||
return current->asClassBinding();
|
||||
}
|
||||
|
||||
processed->insert(this);
|
||||
|
||||
Identifier *id = name->identifier();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user