On 2013-09-16 00:59, Piotr Szturmaj wrote:
I'm looking for something like __traits(getAST, fn). The AST should
represent only run-time (instantiated) code without any compile-time
features.
How hard it would be to implement this in the frontend?
It would enable analysis of code at compile-time (without the need to
modify the compiler).
I would love to have something like that. I've been thinking about that
myself. It's fairly easy to add new things to __traits. Example, I added
getUnitTests. But that just returned the functions representing the unit
tests. Most traits today returns simple types, as strings, bools,
tuples, symbols and so on. I would guess it's a lot more complicated to
return a complete tree of classes/structs. I'm guessing these need to be
defined in druntime as well.
--
/Jacob Carlborg