summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ast-decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ast-decl.cpp')
-rw-r--r--source/slang/slang-ast-decl.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/slang-ast-decl.cpp b/source/slang/slang-ast-decl.cpp
index b2802e304..9931bbcaf 100644
--- a/source/slang/slang-ast-decl.cpp
+++ b/source/slang/slang-ast-decl.cpp
@@ -18,6 +18,19 @@ const TypeExp& TypeConstraintDecl::_getSupOverride() const
//return TypeExp::empty;
}
+InterfaceDecl* findParentInterfaceDecl(Decl* decl)
+{
+ auto ancestor = decl->parentDecl;
+ for (; ancestor; ancestor = ancestor->parentDecl)
+ {
+ if (auto interfaceDecl = as<InterfaceDecl>(ancestor))
+ return interfaceDecl;
+
+ if (as<ExtensionDecl>(ancestor))
+ return nullptr;
+ }
+ return nullptr;
+}
bool isInterfaceRequirement(Decl* decl)
{