summaryrefslogtreecommitdiff
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.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp
index 06603547f..d207b45bf 100644
--- a/source/slang/slang-syntax.cpp
+++ b/source/slang/slang-syntax.cpp
@@ -1242,18 +1242,26 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return rs;
}
-
-
-Module* getModule(Decl* decl)
+
+ModuleDecl* getModuleDecl(Decl* decl)
{
for( auto dd = decl; dd; dd = dd->parentDecl )
{
if(auto moduleDecl = as<ModuleDecl>(dd))
- return moduleDecl->module;
+ return moduleDecl;
}
return nullptr;
}
+Module* getModule(Decl* decl)
+{
+ auto moduleDecl = getModuleDecl(decl);
+ if(!moduleDecl)
+ return nullptr;
+
+ return moduleDecl->module;
+}
+
bool findImageFormatByName(char const* name, ImageFormat* outFormat)
{
static const struct