From 093bf1eb9149ba82258b5a5a159b2f54263b17c2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 31 Oct 2017 11:12:08 -0400 Subject: work in-progress: type checking associated types --- source/slang/syntax.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/slang/syntax.cpp') diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index 165b2d132..97f3cfb15 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -957,6 +957,20 @@ void Type::accept(IValVisitor* visitor, void* extra) return false; } + RefPtr AssocTypeDeclRefType::SubstituteImpl(Substitutions* subst, int* ioDiff) + { + auto parentType = this->GetDeclRef().GetParent().SubstituteImpl(subst, ioDiff); + if (auto aggDeclRef = parentType.As()) + { + Decl* targetTypeDecl = nullptr; + if (aggDeclRef.getDecl()->memberDictionary.TryGetValue(this->GetDeclRef().decl->getName(), targetTypeDecl)) + { + return DeclRefType::Create(this->session, DeclRef(targetTypeDecl, parentType.substitutions)); + } + } + return this; + } + int AssocTypeDeclRefType::GetHashCode() { return declRef.GetHashCode(); -- cgit v1.2.3