fixed a namespace lookup bug

This commit is contained in:
Guenter Obiltschnig 2017-02-18 22:29:24 +01:00
parent 2de97f7ef4
commit 5aa942baed

View File

@ -215,7 +215,12 @@ const Token* Parser::parseNameSpace(const Token* pNext)
std::string name = pNext->tokenString(); std::string name = pNext->tokenString();
pNext = next(); pNext = next();
expectOperator(pNext, OperatorToken::OP_OPENBRACE, "{"); expectOperator(pNext, OperatorToken::OP_OPENBRACE, "{");
NameSpace* pNS = dynamic_cast<NameSpace*>(currentNameSpace()->lookup(name));
std::string fullName = currentNameSpace()->fullName();
if (!fullName.empty()) fullName += "::";
fullName += name;
NameSpace* pNS = dynamic_cast<NameSpace*>(currentNameSpace()->lookup(fullName));
bool undefined = (pNS == 0); bool undefined = (pNS == 0);
if (undefined) pNS = new NameSpace(name, currentNameSpace()); if (undefined) pNS = new NameSpace(name, currentNameSpace());
pushNameSpace(pNS, -1, undefined); pushNameSpace(pNS, -1, undefined);