summaryrefslogtreecommitdiff
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.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/slang/slang-ast-decl.cpp b/source/slang/slang-ast-decl.cpp
index edc79c030..2df9164fb 100644
--- a/source/slang/slang-ast-decl.cpp
+++ b/source/slang/slang-ast-decl.cpp
@@ -18,4 +18,18 @@ const TypeExp& TypeConstraintDecl::_getSupOverride() const
}
+bool isInterfaceRequirement(Decl* decl)
+{
+ auto ancestor = decl->parentDecl;
+ for (; ancestor; ancestor = ancestor->parentDecl)
+ {
+ if (as<InterfaceDecl>(ancestor))
+ return true;
+
+ if (as<ExtensionDecl>(ancestor))
+ return false;
+ }
+ return false;
+}
+
} // namespace Slang