Collect the arguments of all the function calls at a compile time in the whole program.
BoQsc
vaidas.boqsc at gmail.com
Fri Apr 15 18:11:11 UTC 2022
Let's say I have this example program.
I want to get the arguments of all the `some_function();` in the
whole program.
**Even if the scope of the function call is never executed.**
(Ex. due to IF statement being negative.)
I tried to use `__traits` but it seems to not gather any
information about function calls.
Or I'm missing something.
```
import std.stdio;
import std.traits;
void some_function(string argument){}
void main(){
some_function("someargument1");
some_function("someargument2");
if (false){
some_function("someargument3");
}
/* __traits allMembers does not print function calls.
I tried to use allMembers of __traits, but it does not contain
the function calls.
Only the functions definitions/declarations inside a module.
*/
foreach(memberss; __traits(allMembers, mixin(__MODULE__))){
write(" ", isSomeFunction!(mixin(memberss)));
writeln(" \t", fullyQualifiedName!(mixin(memberss)));
}
```
```
```
More information about the Digitalmars-d-learn
mailing list