Retrieving call expression of a function

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 28 07:22:49 PST 2015


On Saturday, 28 November 2015 at 15:02:32 UTC, Quentin Ladeveze 
wrote:
> Hi,
>
> Is it possible to retrieve the calling expression of a function 
> ? Something like that
>
> ---
> import std.stdio;
>
> void funcTest(int x, float y)
> {
>   writefln(get_call());
> }
>
> void main()
> {
>   float x = 0.2;
>   funcTest(1+2, x+2);
> }
> ---
>
> output expected : " funcTest(1+2, x+2) "
>
> Thanks

I do not have right now to provide you with code, but three 
things:

1. Use of mixin,
2. The function call to be written in a string,
3. A wrapper that stores given function call string, saves it, 
and mixin it.


More information about the Digitalmars-d-learn mailing list