From a9214f34358b2fc0bf61ef90e3719a13b180b423 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 8 Apr 2020 10:56:00 -0400 Subject: Remove static struct members from layout and reflection (#1310) * * Added MemberFilterStyle - controls action of FilteredMemberList and FilteredMemberRefList * Splt out template implementations * Use more standard method names dofr FilteredMemberRefList * Added reflect-static.slang test * Added isNotEmpty/isEmpty to filtered lists * Added ability to index into filtered list (so not require building of array) * Default MemberFilterStyle to All. * Remove explicit MemberFilterStyle::All --- source/slang/slang-reflection.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/slang/slang-reflection.cpp') diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp index fe709222b..a3cb88892 100644 --- a/source/slang/slang-reflection.cpp +++ b/source/slang/slang-reflection.cpp @@ -304,7 +304,7 @@ SLANG_API unsigned int spReflectionType_GetFieldCount(SlangReflectionType* inTyp auto declRef = declRefType->declRef; if( auto structDeclRef = declRef.as()) { - return GetFields(structDeclRef).Count(); + return (unsigned int)GetFields(structDeclRef, MemberFilterStyle::Instance).getCount(); } } @@ -323,7 +323,8 @@ SLANG_API SlangReflectionVariable* spReflectionType_GetFieldByIndex(SlangReflect auto declRef = declRefType->declRef; if( auto structDeclRef = declRef.as()) { - auto fieldDeclRef = GetFields(structDeclRef).ToArray()[index]; + auto fields = GetFields(structDeclRef, MemberFilterStyle::Instance); + auto fieldDeclRef = fields[index]; return (SlangReflectionVariable*) fieldDeclRef.getDecl(); } } @@ -1405,7 +1406,7 @@ SLANG_API SlangReflectionType* spReflectionTypeParameter_GetConstraintByIndex(Sl if( auto globalGenericParamDecl = as(genericParamLayout->decl) ) { auto constraints = globalGenericParamDecl->getMembersOfType(); - return (SlangReflectionType*)constraints.toArray()[index]->sup.Ptr(); + return (SlangReflectionType*)constraints[index]->sup.Ptr(); } // TODO: Add case for entry-point generic parameters. } -- cgit v1.2.3