Fixed #3778: Added missing function Function::getArgumentVar

This commit is contained in:
PKEuS 2012-05-03 13:29:41 +02:00
parent 04704ac5fa
commit aec57db9b2
2 changed files with 13 additions and 0 deletions

View File

@ -1666,6 +1666,17 @@ bool Function::isImplicitlyVirtual_rec(const Scope* scope, bool& safe) const
return false; return false;
} }
const Variable* Function::getArgumentVar(unsigned int num) const
{
for (std::list<Variable>::const_iterator i = argumentList.begin(); i != argumentList.end(); ++i) {
if (i->index() == num)
return(&*i);
else if (i->index() > num)
return 0;
}
return 0;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -384,6 +384,8 @@ public:
std::size_t argCount() const { std::size_t argCount() const {
return argumentList.size(); return argumentList.size();
} }
/** @brief get a pointer to the variable instance associated with the given argument number */
const Variable* getArgumentVar(unsigned int num) const;
unsigned int initializedArgCount() const; unsigned int initializedArgCount() const;
void addArguments(const SymbolDatabase *symbolDatabase, const Scope *scope); void addArguments(const SymbolDatabase *symbolDatabase, const Scope *scope);
/** @brief check if this function is virtual in the base classes */ /** @brief check if this function is virtual in the base classes */