base class lookup

This commit is contained in:
Günter Obiltschnig
2023-07-11 08:54:34 +02:00
parent 0bf69ab832
commit da39e3ce70
5 changed files with 36 additions and 9 deletions

View File

@@ -99,7 +99,8 @@ Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& a
return pSymbol;
if (alreadyVisited.find(this) != alreadyVisited.end())
return pSymbol;
return pSymbol;
std::string head;
std::string tail;
splitName(name, head, tail);
@@ -107,7 +108,6 @@ Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& a
alreadyVisited.insert(this);
bool currentNSInserted = true;
if (head.empty())
{
alreadyVisited.insert(this);

View File

@@ -252,4 +252,28 @@ std::string Struct::toString() const
}
Symbol* Struct::lookup(const std::string& name) const
{
Symbol* pSymbol = NameSpace::lookup(name);
if (!pSymbol)
{
for (BaseIterator it = baseBegin(); it != baseEnd(); ++it)
{
if (it->access != Symbol::ACC_PRIVATE)
{
if (it->pClass)
{
pSymbol = it->pClass->lookup(name);
if (pSymbol)
{
return pSymbol;
}
}
}
}
}
return pSymbol;
}
} } // namespace Poco::CppParser