From 746e070f2d7ebc73670da397cf028b6dee2d14b0 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Tue, 7 Mar 2023 01:53:19 +0300 Subject: [PATCH] Itterate statically over members --- source/poodinis/autowire.d | 4 ++-- source/poodinis/container.d | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index 01939ff..3c4aad9 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -304,8 +304,8 @@ class AutowiredRegistration(RegistrationType : Object) : Registration { private void delegate() getPreDestructor(RegistrationType instance) { void delegate() preDestructor = null; - foreach (memberName; __traits(allMembers, RegistrationType)) { - foreach (overload; __traits(getOverloads, instance, memberName)) { + static foreach (memberName; __traits(allMembers, RegistrationType)) { + static foreach (overload; __traits(getOverloads, instance, memberName)) { static if (__traits(compiles, __traits(getProtection, overload)) && __traits(getProtection, overload) == "public" && isFunction!overload diff --git a/source/poodinis/container.d b/source/poodinis/container.d index d3fc353..5633950 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -420,8 +420,8 @@ synchronized class DependencyContainer { } private void callPostConstructors(Type)(Type instance) { - foreach (memberName; __traits(allMembers, Type)) { - foreach (overload; __traits(getOverloads, instance, memberName)) { + static foreach (memberName; __traits(allMembers, Type)) { + static foreach (overload; __traits(getOverloads, instance, memberName)) { static if (__traits(compiles, __traits(getProtection, overload)) && __traits(getProtection, overload) == "public" && isFunction!overload