summaryrefslogtreecommitdiff
path: root/source/slang/slang-ast-support-types.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ast-support-types.h')
-rw-r--r--source/slang/slang-ast-support-types.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/slang/slang-ast-support-types.h b/source/slang/slang-ast-support-types.h
index c172ea83c..884668353 100644
--- a/source/slang/slang-ast-support-types.h
+++ b/source/slang/slang-ast-support-types.h
@@ -1002,6 +1002,8 @@ namespace Slang
/// True if non empty (equivalent to getCount() != 0 but faster)
bool isNonEmpty() const { return isFilterNonEmpty<T>(m_filterStyle, m_decls.begin(), m_decls.end()); }
+ DeclRef<T> getFirstOrNull() { return isEmpty() ? DeclRef<T>() : (*this)[0]; }
+
DeclRef<T> operator[](Index index) const
{
Decl*const* decl = getFilterCursorByIndex<T>(m_filterStyle, m_decls.begin(), m_decls.end(), index);