summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-syntax.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-syntax.cpp')
-rw-r--r--source/slang/slang-syntax.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp
index 53a02ed87..678d9ec26 100644
--- a/source/slang/slang-syntax.cpp
+++ b/source/slang/slang-syntax.cpp
@@ -765,6 +765,17 @@ Module* getModule(Decl* decl)
return moduleDecl->module;
}
+ModuleDecl* getModuleDecl(Scope* scope)
+{
+ for (; scope; scope = scope->parent)
+ {
+ if (scope->containerDecl)
+ return getModuleDecl(scope->containerDecl);
+ }
+ return nullptr;
+
+}
+
Decl* getParentDecl(Decl* decl)
{
decl = decl->parentDecl;