diff options
| author | Yong He <yonghe@outlook.com> | 2017-10-31 11:12:08 -0400 |
|---|---|---|
| committer | Yong He <yonghe@outlook.com> | 2017-10-31 11:12:08 -0400 |
| commit | 093bf1eb9149ba82258b5a5a159b2f54263b17c2 (patch) | |
| tree | 8ee5c2bd4b730d3bd446546dd50f0284d3e47161 /source/slang/syntax.cpp | |
| parent | 84f381cc180b3176d6a58da4085ee8470f246922 (diff) | |
work in-progress: type checking associated types
Diffstat (limited to 'source/slang/syntax.cpp')
| -rw-r--r-- | source/slang/syntax.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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<Val> AssocTypeDeclRefType::SubstituteImpl(Substitutions* subst, int* ioDiff) + { + auto parentType = this->GetDeclRef().GetParent().SubstituteImpl(subst, ioDiff); + if (auto aggDeclRef = parentType.As<AggTypeDecl>()) + { + Decl* targetTypeDecl = nullptr; + if (aggDeclRef.getDecl()->memberDictionary.TryGetValue(this->GetDeclRef().decl->getName(), targetTypeDecl)) + { + return DeclRefType::Create(this->session, DeclRef<Decl>(targetTypeDecl, parentType.substitutions)); + } + } + return this; + } + int AssocTypeDeclRefType::GetHashCode() { return declRef.GetHashCode(); |
