Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6510,16 +6510,16 @@ Type* Scope::findType(const std::string& name)

//---------------------------------------------------------------------------

Scope *Scope::findInNestedListRecursive(const std::string & name)
const Scope *Scope::findInNestedListRecursive(const std::string & name) const
{
auto it = std::find_if(nestedList.cbegin(), nestedList.cend(), [&](const Scope* s) {
return s->className == name;
});
if (it != nestedList.end())
return *it;

for (Scope* scope: nestedList) {
Scope *child = scope->findInNestedListRecursive(name);
for (const Scope* scope: nestedList) {
const Scope *child = scope->findInNestedListRecursive(name);
if (child)
return child;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/symboldatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ class CPPCHECKLIB Scope {
* @brief find if name is in nested list
* @param name name of nested scope
*/
Scope *findInNestedListRecursive(const std::string & name);
const Scope *findInNestedListRecursive(const std::string & name) const;

void addVariable(const Token *token_, const Token *start_,
const Token *end_, AccessControl access_, const Type *type_,
Expand Down
Loading