This patch adds Slang API methods for walking all the declarations in the AST.
We expose this functionality through an abstract DeclReflection class that can be a type, function or a variable declaration. We also provide ways to cast the decl to a FunctionReflection, TypeReflection or VariableReflection and traverse through the child nodes (for instance, a struct type will have component variable declarations)
Additional changes:
Convert FunctionReflection to be a DeclRef rather than a Decl without specialization args. The user-facing API remains the same, so this not a breaking change.
Query to look for the mutating modifier (Use findModifier(slang::Modifier::Mutating))
Query to check if a variable has a default expression
This patch adds Slang API methods for walking all the declarations in the AST.
We expose this functionality through an abstract
DeclReflection
class that can be a type, function or a variable declaration. We also provide ways to cast the decl to aFunctionReflection
,TypeReflection
orVariableReflection
and traverse through the child nodes (for instance, a struct type will have component variable declarations)Additional changes:
Convert
FunctionReflection
to be aDeclRef
rather than aDecl
without specialization args. The user-facing API remains the same, so this not a breaking change.Query to look for the mutating modifier (Use
findModifier(slang::Modifier::Mutating)
)Query to check if a variable has a default expression
Fixes #4617