Refactorization: use Function::nestedIn instead of Function::functionScope->functionOf, which is valid even if the function implementation is not seen.

This commit is contained in:
PKEuS 2013-02-16 01:43:16 -08:00
parent 27f7917349
commit 89cf24f23f
2 changed files with 2 additions and 2 deletions

View File

@ -720,7 +720,7 @@ void CheckOther::checkRedundantAssignment()
else if (Token::Match(tok2, "%var% (") && nonLocal(tok->variable())) { // Called function might use the variable
const Function* func = symbolDatabase->findFunction(tok2);
const Variable* var = tok->variable();
if (!var || var->isGlobal() || var->isReference() || ((!func || !func->functionScope || func->functionScope->functionOf) && tok2->strAt(-1) != ".")) // Global variable, or member function
if (!var || var->isGlobal() || var->isReference() || ((!func || func->nestedIn) && tok2->strAt(-1) != ".")) // Global variable, or member function
error = false;
}
}

View File

@ -1906,7 +1906,7 @@ bool Function::isImplicitlyVirtual(bool defaultVal) const
return true;
else if (access == Private || access == Public || access == Protected) {
bool safe = true;
bool hasVirt = isImplicitlyVirtual_rec(functionScope->functionOf, safe);
bool hasVirt = isImplicitlyVirtual_rec(nestedIn, safe);
if (hasVirt)
return true;
else if (safe)