summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-decl.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-24 12:05:19 -0700
committerGitHub <noreply@github.com>2022-08-24 12:05:19 -0700
commitba6f55ed9481960b4f6c7f0a6b8f1cf7d450c752 (patch)
treebd92bf3cca5614585f8be6ad6f57510b18565b47 /source/slang/slang-ast-decl.cpp
parent3746a47ce407b14c4afbfc5b625513cf81b5e890 (diff)
Allow `static const` interface requirements. (#2378)
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