Compare the scope pointers for local scopes.

This commit is contained in:
Roberto Raggi
2010-08-26 13:38:07 +02:00
parent 5f13608c61
commit c5d48034bb
2 changed files with 12 additions and 1 deletions

View File

@@ -203,6 +203,16 @@ bool FindUsages::compareName(const Name *name, const Name *other)
return false;
}
bool FindUsages::isLocalScope(Scope *scope)
{
if (scope) {
if (scope->isBlock() || scope->isTemplate() || scope->isFunction())
return true;
}
return false;
}
bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
{
for (int i = candidates.size() - 1; i != -1; --i) {
@@ -214,7 +224,7 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
return false;
}
if (_declSymbol->scope() && (_declSymbol->scope()->isFunction() || _declSymbol->scope()->isBlock())) {
if (isLocalScope(_declSymbol->scope()) || isLocalScope(s->scope())) {
if (s->scope() != _declSymbol->scope())
return false;
}

View File

@@ -83,6 +83,7 @@ protected:
static bool compareFullyQualifiedName(const QList<const Name *> &path, const QList<const Name *> &other);
static bool compareName(const Name *name, const Name *other);
static bool isLocalScope(Scope *scope);
void statement(StatementAST *ast);
void expression(ExpressionAST *ast);