Itterate statically over members

This commit is contained in:
Mike Bierlee 2023-03-07 01:53:19 +03:00
parent 0b64013115
commit 746e070f2d
2 changed files with 4 additions and 4 deletions

View file

@ -304,8 +304,8 @@ class AutowiredRegistration(RegistrationType : Object) : Registration {
private void delegate() getPreDestructor(RegistrationType instance) { private void delegate() getPreDestructor(RegistrationType instance) {
void delegate() preDestructor = null; void delegate() preDestructor = null;
foreach (memberName; __traits(allMembers, RegistrationType)) { static foreach (memberName; __traits(allMembers, RegistrationType)) {
foreach (overload; __traits(getOverloads, instance, memberName)) { static foreach (overload; __traits(getOverloads, instance, memberName)) {
static if (__traits(compiles, __traits(getProtection, overload)) static if (__traits(compiles, __traits(getProtection, overload))
&& __traits(getProtection, overload) == "public" && __traits(getProtection, overload) == "public"
&& isFunction!overload && isFunction!overload

View file

@ -420,8 +420,8 @@ synchronized class DependencyContainer {
} }
private void callPostConstructors(Type)(Type instance) { private void callPostConstructors(Type)(Type instance) {
foreach (memberName; __traits(allMembers, Type)) { static foreach (memberName; __traits(allMembers, Type)) {
foreach (overload; __traits(getOverloads, instance, memberName)) { static foreach (overload; __traits(getOverloads, instance, memberName)) {
static if (__traits(compiles, __traits(getProtection, overload)) static if (__traits(compiles, __traits(getProtection, overload))
&& __traits(getProtection, overload) == "public" && __traits(getProtection, overload) == "public"
&& isFunction!overload && isFunction!overload