From a80575608e0296e1779c2085b893145893e4cc20 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 18 Dec 2024 22:25:09 -0800 Subject: Check decl nesting for namespaces. (#5910) --- source/slang/slang-parser.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'source/slang/slang-parser.cpp') 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(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(decl) && decl->parentDecl) + { + return; + } + if (!as(containerDecl)) { // Make sure the decl is properly nested inside its lexical parent -- cgit v1.2.3