From 2f2ae8c31490ab01ce0d0cc76d5d7fcf1d21efe7 Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Wed, 7 Aug 2024 02:04:37 -0400 Subject: More reflection API features. (#4740) * More reflection API features. + Lookup methods and members (by string) on types + Fix issue with looking up non-static members through the scope operator '::' + `GenericReflection`: Cast a decl to generic to access unspecialized generic parameter names and constraints + `GenericReflection`: Use `getGenericContainer()` from function, variable or type to access the 'nearest' generic parent along with specialization info + `GenericReflection::getConcreteType` and `GenericReflection::getConcreteIntVal`: to get the concrete type of a param in the context of the reflection object + `GenericReflection::getOuterGenericContainer` to go up one level and get the outer generic declarations (if there are more than one enclosing generic scopes) + `DeclReflection::getParent`: go to parent declaration. + Change `VariableReflection` to be a `DeclRef` rather than a decl (allows us to return properly substituted types for methods, members, and more) * Fix Falcor issue --- source/slang/slang-compiler.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/slang/slang-compiler.h') diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h index 8e1cb0a88..1180d4be2 100755 --- a/source/slang/slang-compiler.h +++ b/source/slang/slang-compiler.h @@ -420,6 +420,12 @@ namespace Slang DeclRef findDeclFromString( String const& name, DiagnosticSink* sink); + + DeclRef findDeclFromStringInType( + Type* type, + String const& name, + LookupMask mask, + DiagnosticSink* sink); Dictionary& getMangledNameToIntValMap(); ConstantIntVal* tryFoldIntVal(IntVal* intVal); -- cgit v1.2.3