summaryrefslogtreecommitdiffstats
path: root/source/slang/syntax.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/syntax.h')
-rw-r--r--source/slang/syntax.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/slang/syntax.h b/source/slang/syntax.h
index 7bd2afc12..5eb40fefb 100644
--- a/source/slang/syntax.h
+++ b/source/slang/syntax.h
@@ -293,6 +293,9 @@ namespace Slang
RefPtr<Type> type;
bool IsLeftValue;
+ template <typename T>
+ T* As();
+
QualType()
: IsLeftValue(false)
{}
@@ -1108,6 +1111,13 @@ namespace Slang
#include "object-meta-end.h"
+
+ template <typename T>
+ SLANG_FORCE_INLINE T* QualType::As()
+ {
+ return type ? type->As<T>() : nullptr;
+ }
+
inline RefPtr<Type> GetSub(DeclRef<GenericTypeConstraintDecl> const& declRef)
{
return declRef.Substitute(declRef.getDecl()->sub.Ptr());
@@ -1314,4 +1324,4 @@ namespace Slang
RefPtr<GenericSubstitution> findInnerMostGenericSubstitution(Substitutions* subst);
} // namespace Slang
-#endif \ No newline at end of file
+#endif