From a2d90fb275962da84611160f8ddd74d934a68dbd Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 4 Aug 2023 15:47:39 -0700 Subject: Redesign `DeclRef` and systematic `Val` deduplication (#3049) * Redesign DeclRef + Deduplicate Val. * Update project files * Fix warning. * Fix. * Fix. * Remove `Val::_equalsImplOverride`. * Rmove `Val::_getHashCodeOverride`. * Remove `semanticVisitor` param from `resolve`. * Cleanups. --------- Co-authored-by: Yong He --- source/slang/slang-ast-decl.cpp | 18 ++++++++++++++++++ 1 file changed, 18 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 2f1c7c47e..9dbd006a0 100644 --- a/source/slang/slang-ast-decl.cpp +++ b/source/slang/slang-ast-decl.cpp @@ -4,6 +4,7 @@ #include #include "slang-generated-ast-macro.h" +#include "slang-ast-decl.h" namespace Slang { @@ -118,4 +119,21 @@ bool isLocalVar(const Decl* decl) return false; } +ThisTypeDecl* InterfaceDecl::getThisTypeDecl() +{ + for (auto member : members) + { + if (auto thisTypeDeclCandidate = as(member)) + { + return thisTypeDeclCandidate; + } + } + SLANG_UNREACHABLE("InterfaceDecl does not have a ThisType decl."); +} + +InterfaceDecl* ThisTypeConstraintDecl::getInterfaceDecl() +{ + return as(parentDecl->parentDecl); +} + } // namespace Slang -- cgit v1.2.3