diff options
| author | Roberto Raggi <[email protected]> | 2010-08-11 12:26:02 +0200 |
|---|---|---|
| committer | Roberto Raggi <[email protected]> | 2010-08-11 15:25:18 +0200 |
| commit | 354b9712e4655040930a9f18de4e6b4c71dc42d9 (patch) | |
| tree | 474bab43aa8a84893f38b8a0552f8071404e6a12 /src/libs/cplusplus/FindUsages.cpp | |
| parent | 5accc9664ea247a5b9e1fa6097a04252fb57f01b (diff) | |
Merged ScopedSymbol and Scope.
Diffstat (limited to 'src/libs/cplusplus/FindUsages.cpp')
| -rw-r--r-- | src/libs/cplusplus/FindUsages.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index c42c125b90e..a381bb91b21 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -209,7 +209,7 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const const LookupItem &r = candidates.at(i); if (Symbol *s = r.declaration()) { - if (_declSymbol->scope() && (_declSymbol->scope()->isPrototypeScope() || _declSymbol->scope()->isBlockScope())) { + if (_declSymbol->scope() && (_declSymbol->scope()->isFunction() || _declSymbol->scope()->isBlock())) { if (s->scope() != _declSymbol->scope()) return false; @@ -240,19 +240,12 @@ void FindUsages::checkExpression(unsigned startToken, unsigned endToken, Scope * reportResult(endToken, results); } -Scope *FindUsages::switchScope(ScopedSymbol *symbol) -{ - if (! symbol) - return _currentScope; // ### assert? - - return switchScope(symbol->members()); -} - Scope *FindUsages::switchScope(Scope *scope) { - Scope *previousScope = _currentScope; - _currentScope = scope; - return previousScope; + if (! scope) + return _currentScope; + + return switchScope(scope); } void FindUsages::statement(StatementAST *ast) @@ -345,7 +338,7 @@ bool FindUsages::visit(DeclaratorAST *ast) return false; } -void FindUsages::declarator(DeclaratorAST *ast, ScopedSymbol *symbol) +void FindUsages::declarator(DeclaratorAST *ast, Scope *symbol) { if (! ast) return; @@ -493,13 +486,13 @@ void FindUsages::memInitializer(MemInitializerAST *ast) if (! ast) return; - if (_currentScope->isPrototypeScope()) { - Scope *classScope = _currentScope->enclosingClassScope(); + if (_currentScope->isFunction()) { + Class *classScope = _currentScope->enclosingClass(); if (! classScope) { - if (ClassOrNamespace *binding = _context.lookupType(_currentScope->owner())) { + if (ClassOrNamespace *binding = _context.lookupType(_currentScope)) { foreach (Symbol *s, binding->symbols()) { if (Class *k = s->asClass()) { - classScope = k->members(); + classScope = k; break; } } @@ -658,7 +651,7 @@ void FindUsages::translationUnit(TranslationUnitAST *ast) if (! ast) return; - Scope *previousScope = switchScope(_doc->globalSymbols()); + Scope *previousScope = switchScope(_doc->globalNamespace()); for (DeclarationListAST *it = ast->declaration_list; it; it = it->next) { this->declaration(it->value); } |
