diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-12-01 12:46:15 +0100 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-12-01 12:46:23 +0100 |
commit | 7c7ce13ac09d1a3a3807d0f4fea97688554d28d3 (patch) | |
tree | 9c73a3a6743ec973c0b7ec5cce9404a13bbbd9a0 /src/shared/cplusplus/Scope.cpp | |
parent | f2e77fb8fd2f3c06ccb7ab922bbde6a4f7a1f7f0 (diff) | |
download | qt-creator-7c7ce13ac09d1a3a3807d0f4fea97688554d28d3.tar.gz |
Use const names.
Diffstat (limited to 'src/shared/cplusplus/Scope.cpp')
-rw-r--r-- | src/shared/cplusplus/Scope.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/shared/cplusplus/Scope.cpp b/src/shared/cplusplus/Scope.cpp index 76d09eb2dc..0fae6db391 100644 --- a/src/shared/cplusplus/Scope.cpp +++ b/src/shared/cplusplus/Scope.cpp @@ -204,12 +204,12 @@ void Scope::enterSymbol(Symbol *symbol) } } -Symbol *Scope::lookat(Name *name) const +Symbol *Scope::lookat(const Name *name) const { if (! name) return 0; - else if (OperatorNameId *opId = name->asOperatorNameId()) + else if (const OperatorNameId *opId = name->asOperatorNameId()) return lookat(opId->kind()); else if (const Identifier *id = name->identifier()) @@ -227,21 +227,21 @@ Symbol *Scope::lookat(const Identifier *id) const const unsigned h = id->hashCode() % _hashSize; Symbol *symbol = _hash[h]; for (; symbol; symbol = symbol->_next) { - Name *identity = symbol->identity(); + const Name *identity = symbol->identity(); if (! identity) { continue; - } else if (NameId *nameId = identity->asNameId()) { + } else if (const NameId *nameId = identity->asNameId()) { if (nameId->identifier()->isEqualTo(id)) break; - } else if (TemplateNameId *t = identity->asTemplateNameId()) { + } else if (const TemplateNameId *t = identity->asTemplateNameId()) { if (t->identifier()->isEqualTo(id)) break; - } else if (DestructorNameId *d = identity->asDestructorNameId()) { + } else if (const DestructorNameId *d = identity->asDestructorNameId()) { if (d->identifier()->isEqualTo(id)) break; } else if (identity->isQualifiedNameId()) { - assert(0); - } else if (SelectorNameId *selectorNameId = identity->asSelectorNameId()) { + return 0; + } else if (const SelectorNameId *selectorNameId = identity->asSelectorNameId()) { if (selectorNameId->identifier()->isEqualTo(id)) break; } @@ -257,8 +257,8 @@ Symbol *Scope::lookat(int operatorId) const const unsigned h = operatorId % _hashSize; Symbol *symbol = _hash[h]; for (; symbol; symbol = symbol->_next) { - Name *identity = symbol->identity(); - if (OperatorNameId *op = identity->asOperatorNameId()) { + const Name *identity = symbol->identity(); + if (const OperatorNameId *op = identity->asOperatorNameId()) { if (op->kind() == operatorId) break; } |