Get unknown symbol (struct, method, class) tagged with User Defined Attributes

Adam D. Ruppe destructionator at gmail.com
Tue May 12 02:53:53 UTC 2020


On Tuesday, 12 May 2020 at 02:51:39 UTC, Doug wrote:
> So far I've only seen a way to get unknown UDAs from known 
> symbols but not how to get unknown symbols from UDAs. Is there 
> any documentation for how to get a list of symbols annotated 
> with a specific UDA?

see std.traits.getSymbolsByUDA

http://dpldocs.info/experimental-docs/std.traits.getSymbolsByUDA.html

there's some caveats, like it only searches one particular parent 
symbol for its children

(that's because the way this works is you reflect through 
children checking each symbol child's uda list to see if it is 
present)

but it basically works for many things at least contained 
per-module. you can pass each module you care about in though to 
generate a more full list


More information about the Digitalmars-d-learn mailing list