list of all defined items in a D file

Basile B. b2.temp at gmx.com
Sat Jan 25 10:01:20 UTC 2020


On Friday, 24 January 2020 at 14:28:03 UTC, berni44 wrote:
> On Friday, 24 January 2020 at 12:22:49 UTC, Dennis wrote:
>> You can pass the -X flag to dmd, which makes it generate a 
>> .json file describing the compiled file.
>
> Great, that's what I was looking for - although it's also good 
> to know the __traits approach!
>
> Thanks!

a 3rd approach is to use libdparse and make your own AST 
serializer by writing a visitor. (or even with DMD front end as a 
library). Although if it's a matter of time the dmd -X flag is 
great in the sense that the output format is standard and 
straightforward.


More information about the Digitalmars-d-learn mailing list