Re: Extract code of function

2019-05-26 Thread Andrey via Digitalmars-d-learn
On Sunday, 26 May 2019 at 18:21:23 UTC, Dennis wrote: On Sunday, 26 May 2019 at 18:14:23 UTC, Jacob Carlborg wrote: No, that's not possible. Some hacky solutions are possible by importing a source file as a string and parsing it manually. dglsl actually extracts D function code to put into

Re: Extract code of function

2019-05-26 Thread Dennis via Digitalmars-d-learn
On Sunday, 26 May 2019 at 18:14:23 UTC, Jacob Carlborg wrote: No, that's not possible. Some hacky solutions are possible by importing a source file as a string and parsing it manually. dglsl actually extracts D function code to put into glsl shaders. Here's the snippet. See:

Re: Extract code of function

2019-05-26 Thread Aphex via Digitalmars-d-learn
On Sunday, 26 May 2019 at 17:46:35 UTC, Andrey wrote: Hello, Is it possible to extract code of some function into string variable using CT reflextion? For example: int test(bool flag) { return flag ? 100 : getRandom(); } enum string code = GetFunctionCode!test; // "return flag

Re: Extract code of function

2019-05-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-05-26 19:46, Andrey wrote: Hello, Is it possible to extract code of some function into string variable using CT reflextion? For example: int test(bool flag) {     return flag ? 100 : getRandom(); } enum string code = GetFunctionCode!test; // "return flag ? 100 : getR

Extract code of function

2019-05-26 Thread Andrey via Digitalmars-d-learn
Hello, Is it possible to extract code of some function into string variable using CT reflextion? For example: int test(bool flag) { return flag ? 100 : getRandom(); } enum string code = GetFunctionCode!test; // "return flag ? 100 : getRandom();"