| 6465 | |
| 6466 | template<class S, class T, REQUIRES("S must be a Scope class", std::is_convertible<S*, const Scope*> ), REQUIRES("T must be a Type class", std::is_convertible<T*, const Type*> )> |
| 6467 | static S* findRecordInNestedListImpl(S& thisScope, const std::string& name, bool isC, std::set<const Scope*>& visited) |
| 6468 | { |
| 6469 | for (S* scope: thisScope.nestedList) { |
| 6470 | if (scope->className == name && scope->type != ScopeType::eFunction) |
| 6471 | return scope; |
| 6472 | if (isC) { |
| 6473 | S* nestedScope = scope->findRecordInNestedList(name, isC); |
| 6474 | if (nestedScope) |
| 6475 | return nestedScope; |
| 6476 | } |
| 6477 | } |
| 6478 | |
| 6479 | for (const auto& u : thisScope.usingList) { |
| 6480 | if (!u.scope || u.scope == &thisScope || visited.find(u.scope) != visited.end()) |
| 6481 | continue; |
| 6482 | visited.emplace(u.scope); |
| 6483 | S* nestedScope = findRecordInNestedListImpl<S, T>(const_cast<S&>(*u.scope), name, false, visited); |
| 6484 | if (nestedScope) |
| 6485 | return nestedScope; |
| 6486 | } |
| 6487 | |
| 6488 | T * nested_type = thisScope.findType(name); |
| 6489 | |
| 6490 | if (nested_type) { |
| 6491 | if (nested_type->isTypeAlias()) { |
| 6492 | if (nested_type->typeStart == nested_type->typeEnd) |
| 6493 | return thisScope.findRecordInNestedList(nested_type->typeStart->str()); // TODO: pass isC? |
| 6494 | } else |
| 6495 | return const_cast<S*>(nested_type->classScope); |
| 6496 | } |
| 6497 | |
| 6498 | return nullptr; |
| 6499 | } |
| 6500 | |
| 6501 | const Scope* Scope::findRecordInNestedList(const std::string & name, bool isC) const |
| 6502 | { |
nothing calls this directly
no test coverage detected