SymbolDatabase: Simplification of code. My assumption is that start and end of scope is never null.

This commit is contained in:
Daniel Marjamäki 2017-09-20 23:06:19 +02:00
parent ba8222de1c
commit aa38556e1c
1 changed files with 17 additions and 19 deletions

View File

@ -1127,18 +1127,17 @@ void SymbolDatabase::createSymbolDatabaseSetScopePointers()
start = const_cast<Token*>(_tokenizer->list.front()); start = const_cast<Token*>(_tokenizer->list.front());
end = const_cast<Token*>(_tokenizer->list.back()); end = const_cast<Token*>(_tokenizer->list.back());
} }
if (start && end) { assert(start && end);
start->scope(&*it);
end->scope(&*it); end->scope(&*it);
}
if (start != end && start->next() != end) { for (Token* tok = start; tok != end; tok = tok->next()) {
for (Token* tok = start->next(); tok != end; tok = tok->next()) { if (start != end && tok->str() == "{") {
if (tok->str() == "{") {
bool isEndOfScope = false; bool isEndOfScope = false;
for (std::list<Scope*>::const_iterator innerScope = it->nestedList.begin(); innerScope != it->nestedList.end(); ++innerScope) { for (std::list<Scope*>::const_iterator innerScope = it->nestedList.begin(); innerScope != it->nestedList.end(); ++innerScope) {
if (tok == (*innerScope)->classStart) { // Is begin of inner scope if (tok == (*innerScope)->classStart) { // Is begin of inner scope
tok = tok->link(); tok = tok->link();
if (!tok || tok->next() == end || !tok->next()) { if (tok->next() == end || !tok->next()) {
isEndOfScope = true; isEndOfScope = true;
break; break;
} }
@ -1153,7 +1152,6 @@ void SymbolDatabase::createSymbolDatabaseSetScopePointers()
} }
} }
} }
}
void SymbolDatabase::createSymbolDatabaseSetFunctionPointers(bool firstPass) void SymbolDatabase::createSymbolDatabaseSetFunctionPointers(bool firstPass)
{ {