DIP 50 - AST macros

Jacob Carlborg doob at me.com
Thu Nov 14 00:01:06 PST 2013


On 2013-11-13 23:29, Martin Nowak wrote:

> Right, that's the basic functionality we want.
> What's not clear is how to get the type of y.

That's what the reflection API is for. I guess many people here know a 
lot more about building AST's than me. But here's a simple API:

auto ast = "x = y".astof;

auto type = ast.right.type;
auto name = type.name;

assert(ast.left.type == type);

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list