summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ast-decl.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-11-23 16:02:56 -0800
committerGitHub <noreply@github.com>2022-11-23 16:02:56 -0800
commit4ad0470025da4e808c46023f9a2525febcf973a2 (patch)
tree8fcb1c84121ddf40c50ca58b5de867da0da435ee /source/slang/slang-ast-decl.cpp
parent97cb4851eed7a43f10196971b08d3d311386ce9f (diff)
Fix issues around dynamic generic function and autodiff. (#2528)
* Fix issues around dynamic generic function and autodiff. * Fix return type issue. * Fix type unification for generic `inout` parameter. * Fix. Co-authored-by: Yong He <yhe@nvidia.com>
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)
{