refactor doFindNamespace

This commit is contained in:
Roy Qu 2024-04-05 21:40:40 +08:00
parent 16a3c0ad7a
commit 12153bf16a
1 changed files with 2 additions and 2 deletions

View File

@ -358,7 +358,7 @@ PStatement CppParser::doFindStatementOf(const QString &fileName,
PStatement statement;
getFullNamespace(phrase, namespaceName, remainder);
if (!namespaceName.isEmpty()) { // (namespace )qualified Name
PStatementList namespaceList = mNamespaces.value(namespaceName);
PStatementList namespaceList = doFindNamespace(namespaceName);
if (!namespaceList || namespaceList->isEmpty())
return PStatement();
@ -1494,7 +1494,7 @@ PStatement CppParser::addStatement(const PStatement& parent,
result->type.squeeze();
mStatementList.add(result);
if (result->kind == StatementKind::Namespace) {
PStatementList namespaceList = mNamespaces.value(result->fullName,PStatementList());
PStatementList namespaceList = doFindNamespace(result->fullName);
if (!namespaceList) {
namespaceList=std::make_shared<StatementList>();
mNamespaces.insert(result->fullName,namespaceList);