summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 1dc230dae..806912abe 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -8485,6 +8485,16 @@ bool SemanticsVisitor::isScalarIntegerType(Type* type)
return isIntegerBaseType(baseType) || baseType == BaseType::Bool;
}
+Type* SemanticsVisitor::getMatchingIntType(Type* type)
+{
+ if (isScalarIntegerType(type))
+ return type;
+ if (auto enumTypeDecl = isDeclRefTypeOf<EnumDecl>(type))
+ if (enumTypeDecl.getDecl()->tagType)
+ return getMatchingIntType(enumTypeDecl.getDecl()->tagType);
+ return m_astBuilder->getIntType();
+}
+
bool SemanticsVisitor::isHalfType(Type* type)
{
auto basicType = as<BasicExpressionType>(type);