diff options
Diffstat (limited to 'source/slang/slang-syntax.cpp')
| -rw-r--r-- | source/slang/slang-syntax.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index 11729800c..606c77096 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -1413,6 +1413,17 @@ Decl* getParentDecl(Decl* decl) return decl; } +Decl* getParentFunc(Decl* decl) +{ + while (decl) + { + if (as<FunctionDeclBase>(decl)) + return decl; + decl = decl->parentDecl; + } + return nullptr; +} + static const ImageFormatInfo kImageFormatInfos[] = { #define SLANG_IMAGE_FORMAT_INFO(TYPE, COUNT, SIZE) SLANG_SCALAR_TYPE_##TYPE, uint8_t(COUNT), uint8_t(SIZE) |
