www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13298] New: __traits(calledFunctions, f)

https://issues.dlang.org/show_bug.cgi?id=13298

          Issue ID: 13298
           Summary: __traits(calledFunctions, f)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

I suggest to add a trait that returns a tuple of all the functions called by a
given function, including run-time functions.


void foo() {}
void bar() {}
void spam() { foo(); bar(); }

is(__traits(calledFunctions, spam) == TypeTuple!(foo, bar))

This is useful to implement in user code transitive function properties tagged
with UDAs.

Optionally this trait too can be handy:

__traits(isRuntimeFunction, f)

--
Aug 15 2014