diff options
Diffstat (limited to 'source/slang/syntax.cpp')
| -rw-r--r-- | source/slang/syntax.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index 6cf3fd7c9..97f3cfb15 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -940,6 +940,47 @@ void Type::accept(IValVisitor* visitor, void* extra) return this; } + // AssocTypeDeclRefType + + String AssocTypeDeclRefType::ToString() + { + // TODO: what is appropriate here? + return "<AssocType>"; + } + + bool AssocTypeDeclRefType::EqualsImpl(Type * type) + { + if (auto assocTypeDeclRefType = type->As<AssocTypeDeclRefType>()) + { + return declRef.Equals(assocTypeDeclRefType->declRef); + } + 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(); + } + + Type* AssocTypeDeclRefType::CreateCanonicalType() + { + return this; + } + // ArithmeticExpressionType // VectorExpressionType |
