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.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 5aff41988..e3b05ec00 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -34,7 +34,7 @@ static bool isAssociatedTypeDecl(Decl* decl)
return false;
}
-static bool isSlang2026OrLater(SemanticsVisitor* visitor)
+bool isSlang2026OrLater(SemanticsVisitor* visitor)
{
return visitor->getShared()->m_module->getModuleDecl()->languageVersion >=
SLANG_LANGUAGE_VERSION_2026;
@@ -1604,6 +1604,23 @@ EnumDecl* isEnumType(Type* type)
return nullptr;
}
+bool isNullableType(Type* type)
+{
+ if (as<PtrTypeBase>(type))
+ return true;
+ if (isDeclRefTypeOf<InterfaceDecl>(type))
+ return true;
+ if (isDeclRefTypeOf<ClassDecl>(type))
+ return true;
+ if (as<OptionalType>(type))
+ return true;
+ if (as<RefTypeBase>(type))
+ return true;
+ if (as<NativeStringType>(type))
+ return true;
+ return false;
+}
+
bool SemanticsVisitor::shouldSkipChecking(Decl* decl, DeclCheckState state)
{
if (state < DeclCheckState::DefinitionChecked)