| 6514 | |
| 6515 | 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*> )> |
| 6516 | static T* findTypeImpl(S& thisScope, const std::string & name) |
| 6517 | { |
| 6518 | auto it = thisScope.definedTypesMap.find(name); |
| 6519 | |
| 6520 | // Type was found |
| 6521 | if (thisScope.definedTypesMap.end() != it) |
| 6522 | return it->second; |
| 6523 | |
| 6524 | // is type defined in anonymous namespace.. |
| 6525 | it = thisScope.definedTypesMap.find(""); |
| 6526 | if (it != thisScope.definedTypesMap.end()) { |
| 6527 | for (S *scope : thisScope.nestedList) { |
| 6528 | if (scope->className.empty() && (scope->type == ScopeType::eNamespace || scope->isClassOrStructOrUnion())) { |
| 6529 | T *t = scope->findType(name); |
| 6530 | if (t) |
| 6531 | return t; |
| 6532 | } |
| 6533 | } |
| 6534 | } |
| 6535 | |
| 6536 | // Type was not found |
| 6537 | return nullptr; |
| 6538 | } |
| 6539 | |
| 6540 | const Type* Scope::findType(const std::string& name) const |
| 6541 | { |