diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-04-08 10:56:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-08 10:56:00 -0400 |
| commit | a9214f34358b2fc0bf61ef90e3719a13b180b423 (patch) | |
| tree | 115b49d976f871a9f529436e201cf2f4a1a59401 /source/slang/slang-reflection.cpp | |
| parent | ba232e44cbb016a4e7c111b42458394027369c5e (diff) | |
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
Diffstat (limited to 'source/slang/slang-reflection.cpp')
| -rw-r--r-- | source/slang/slang-reflection.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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<StructDecl>()) { - 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<StructDecl>()) { - 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<GlobalGenericParamDecl>(genericParamLayout->decl) ) { auto constraints = globalGenericParamDecl->getMembersOfType<GenericTypeConstraintDecl>(); - return (SlangReflectionType*)constraints.toArray()[index]->sup.Ptr(); + return (SlangReflectionType*)constraints[index]->sup.Ptr(); } // TODO: Add case for entry-point generic parameters. } |
