Skip to content

Commit ba14d48

Browse files
authored
made Scope::findInNestedListRecursive() const (danmar#8236)
1 parent a5db405 commit ba14d48

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/symboldatabase.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6530,16 +6530,16 @@ Type* Scope::findType(const std::string& name)
65306530

65316531
//---------------------------------------------------------------------------
65326532

6533-
Scope *Scope::findInNestedListRecursive(const std::string & name)
6533+
const Scope *Scope::findInNestedListRecursive(const std::string & name) const
65346534
{
65356535
auto it = std::find_if(nestedList.cbegin(), nestedList.cend(), [&](const Scope* s) {
65366536
return s->className == name;
65376537
});
65386538
if (it != nestedList.end())
65396539
return *it;
65406540

6541-
for (Scope* scope: nestedList) {
6542-
Scope *child = scope->findInNestedListRecursive(name);
6541+
for (const Scope* scope: nestedList) {
6542+
const Scope *child = scope->findInNestedListRecursive(name);
65436543
if (child)
65446544
return child;
65456545
}

lib/symboldatabase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ class CPPCHECKLIB Scope {
11571157
* @brief find if name is in nested list
11581158
* @param name name of nested scope
11591159
*/
1160-
Scope *findInNestedListRecursive(const std::string & name);
1160+
const Scope *findInNestedListRecursive(const std::string & name) const;
11611161

11621162
void addVariable(const Token *token_, const Token *start_,
11631163
const Token *end_, AccessControl access_, const Type *type_,

0 commit comments

Comments
 (0)