| 6578 | //--------------------------------------------------------------------------- |
| 6579 | |
| 6580 | const Scope *SymbolDatabase::findScope(const Token *tok, const Scope *startScope) const |
| 6581 | { |
| 6582 | const Scope *scope = nullptr; |
| 6583 | // absolute path |
| 6584 | if (tok->str() == "::") { |
| 6585 | tok = tok->next(); |
| 6586 | scope = &scopeList.front(); |
| 6587 | } |
| 6588 | // relative path |
| 6589 | else if (tok->isName()) { |
| 6590 | scope = startScope; |
| 6591 | } |
| 6592 | |
| 6593 | while (scope && tok && tok->isName()) { |
| 6594 | if (tok->strAt(1) == "::") { |
| 6595 | scope = scope->findRecordInNestedList(tok->str()); |
| 6596 | tok = tok->tokAt(2); |
| 6597 | } else if (tok->strAt(1) == "<") |
| 6598 | return nullptr; |
| 6599 | else |
| 6600 | return scope->findRecordInNestedList(tok->str()); |
| 6601 | } |
| 6602 | |
| 6603 | // not a valid path |
| 6604 | return nullptr; |
| 6605 | } |
| 6606 | |
| 6607 | //--------------------------------------------------------------------------- |
| 6608 | |