summaryrefslogtreecommitdiffstats
path: root/source/slang/syntax.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/syntax.cpp')
-rw-r--r--source/slang/syntax.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp
index 4dbb6c05b..b863cb707 100644
--- a/source/slang/syntax.cpp
+++ b/source/slang/syntax.cpp
@@ -294,6 +294,15 @@ void Type::accept(IValVisitor* visitor, void* extra)
declRef)->As<PtrType>();
}
+ RefPtr<GroupSharedType> Session::getGroupSharedType(RefPtr<Type> valueType)
+ {
+ RefPtr<GroupSharedType> groupSharedType = new GroupSharedType();
+ groupSharedType->setSession(this);
+ groupSharedType->valueType = valueType;
+ return groupSharedType;
+ }
+
+
SyntaxClass<RefObject> Session::findSyntaxClass(Name* name)
{
SyntaxClass<RefObject> syntaxClass;
@@ -337,6 +346,36 @@ void Type::accept(IValVisitor* visitor, void* extra)
return baseType->ToString() + "[]";
}
+ // GroupSharedType
+
+ Slang::String GroupSharedType::ToString()
+ {
+ return "@ThreadGroup " + valueType->ToString();
+ }
+
+ bool GroupSharedType::EqualsImpl(Type * type)
+ {
+ auto t = type->As<GroupSharedType>();
+ if (!t)
+ return false;
+ return valueType->Equals(t->valueType);
+ }
+
+ Type* GroupSharedType::CreateCanonicalType()
+ {
+ auto canonicalValueType = valueType->GetCanonicalType();
+ auto canonicalGroupSharedType = getSession()->getGroupSharedType(canonicalValueType);
+ session->canonicalTypes.Add(canonicalGroupSharedType);
+ return canonicalGroupSharedType;
+ }
+
+ int GroupSharedType::GetHashCode()
+ {
+ return combineHash(
+ valueType->GetHashCode(),
+ (int)(typeid(this).hash_code()));
+ }
+
// DeclRefType
String DeclRefType::ToString()