Merge pull request #377 from Dmitry-Me/bringDeclarationsCloserToWhereTheyreNeeded

Bring declarations closer to where they're needed.
This commit is contained in:
PKEuS 2014-07-24 19:01:44 +02:00
commit 499821de4d
1 changed files with 5 additions and 6 deletions

View File

@ -1428,13 +1428,8 @@ Function* SymbolDatabase::addGlobalFunctionDecl(Scope*& scope, const Token *tok,
void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const Token *argStart)
{
int count = 0;
std::string path;
unsigned int path_length = 0;
const Token *tok1;
const bool destructor((*tok)->previous()->str() == "~");
const Token *tok1;
// skip class/struct name
if (destructor)
tok1 = (*tok)->tokAt(-3);
@ -1445,6 +1440,10 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
if (!tok1)
return;
int count = 0;
std::string path;
unsigned int path_length = 0;
// back up to head of path
while (tok1 && tok1->previous() && tok1->previous()->str() == "::" &&
tok1->tokAt(-2) && tok1->tokAt(-2)->isName()) {