From 4ad0470025da4e808c46023f9a2525febcf973a2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 23 Nov 2022 16:02:56 -0800 Subject: 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 --- source/slang/slang-ast-decl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/slang/slang-ast-decl.cpp') 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(ancestor)) + return interfaceDecl; + + if (as(ancestor)) + return nullptr; + } + return nullptr; +} bool isInterfaceRequirement(Decl* decl) { -- cgit v1.2.3