summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parser.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-18 22:25:09 -0800
committerGitHub <noreply@github.com>2024-12-18 22:25:09 -0800
commita80575608e0296e1779c2085b893145893e4cc20 (patch)
tree3521c2b5e646a2728859e177d09820119d4819bb /source/slang/slang-parser.cpp
parentabeb3758f35a48c2012dd3c39d704409c679a652 (diff)
Check decl nesting for namespaces. (#5910)
Diffstat (limited to 'source/slang/slang-parser.cpp')
-rw-r--r--source/slang/slang-parser.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index 5554724a7..10dbe3140 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -4634,14 +4634,6 @@ static void CompleteDecl(
ContainerDecl* containerDecl,
Modifiers modifiers)
{
-
- // If this is a namespace and already added, we don't want to add to the parent
- // Or add any modifiers
- if (as<NamespaceDecl>(decl) && decl->parentDecl)
- {
- return;
- }
-
// Add any modifiers we parsed before the declaration to the list
// of modifiers on the declaration itself.
//
@@ -4699,6 +4691,13 @@ static void CompleteDecl(
}
}
+ // If this is a namespace and already added, we don't want to add to the parent
+ // Or add any modifiers
+ if (as<NamespaceDecl>(decl) && decl->parentDecl)
+ {
+ return;
+ }
+
if (!as<GenericDecl>(containerDecl))
{
// Make sure the decl is properly nested inside its lexical parent