diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-05-12 12:53:16 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-05-14 13:55:21 +0200 |
commit | 60f76c96e8cf9b751e6250a9f80d2517adaf7a5b (patch) | |
tree | 098e360e59bf66ca8688582da8896a576554a531 /src/libs/cplusplus/LookupItem.cpp | |
parent | 140756eef42f4b580c9aecac33c2284d3937bf9f (diff) | |
download | qt-creator-60f76c96e8cf9b751e6250a9f80d2517adaf7a5b.tar.gz |
Improved LookupItem and get rid of some deprecated code.
Diffstat (limited to 'src/libs/cplusplus/LookupItem.cpp')
-rw-r--r-- | src/libs/cplusplus/LookupItem.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/libs/cplusplus/LookupItem.cpp b/src/libs/cplusplus/LookupItem.cpp index a4ddfa77b7..2502c02790 100644 --- a/src/libs/cplusplus/LookupItem.cpp +++ b/src/libs/cplusplus/LookupItem.cpp @@ -39,16 +39,12 @@ using namespace CPlusPlus; uint CPlusPlus::qHash(const CPlusPlus::LookupItem &key) { const uint h1 = QT_PREPEND_NAMESPACE(qHash)(key.type().type()); - const uint h2 = QT_PREPEND_NAMESPACE(qHash)(key.lastVisibleSymbol()); + const uint h2 = QT_PREPEND_NAMESPACE(qHash)(key.scope()); return ((h1 << 16) | (h1 >> 16)) ^ h2; } LookupItem::LookupItem() - : _lastVisibleSymbol(0), _declaration(0) -{ } - -LookupItem::LookupItem(const FullySpecifiedType &type, Symbol *lastVisibleSymbol, Symbol *declaration) - : _type(type), _lastVisibleSymbol(lastVisibleSymbol), _declaration(declaration) + : _scope(0), _declaration(0) { } FullySpecifiedType LookupItem::type() const @@ -63,15 +59,20 @@ Symbol *LookupItem::declaration() const void LookupItem::setDeclaration(Symbol *declaration) { _declaration = declaration; } -Symbol *LookupItem::lastVisibleSymbol() const -{ return _lastVisibleSymbol; } +Scope *LookupItem::scope() const +{ + if (! _scope && _declaration) + return _declaration->scope(); + + return _scope; +} -void LookupItem::setLastVisibleSymbol(Symbol *symbol) -{ _lastVisibleSymbol = symbol; } +void LookupItem::setScope(Scope *scope) +{ _scope = scope; } bool LookupItem::operator == (const LookupItem &other) const { - if (_type == other._type && _declaration == other._declaration && _lastVisibleSymbol == other._lastVisibleSymbol) + if (_type == other._type && _declaration == other._declaration && _scope == other._scope) return true; return false; |