From 15d8c7e754398632f76c3c99d1a3d6e2e2dde037 Mon Sep 17 00:00:00 2001 From: heromyth Date: Mon, 10 Feb 2020 15:34:00 +0800 Subject: [PATCH] Restore callPostConstructors --- source/poodinis/container.d | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/poodinis/container.d b/source/poodinis/container.d index 73b6a15..5b0f759 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -438,16 +438,16 @@ synchronized class DependencyContainer { } private void callPostConstructors(Type)(Type instance) { - // foreach (memberName; __traits(allMembers, Type)) { - // mixin(createImportsString!Type); - - // static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName))) - // && __traits(getProtection, __traits(getMember, instance, memberName)) == "public" - // && isFunction!(mixin(fullyQualifiedName!Type ~ `.` ~ memberName)) - // && hasUDA!(__traits(getMember, instance, memberName), PostConstruct)) { - // __traits(getMember, instance, memberName)(); - // } - // } + foreach (memberName; __traits(allMembers, Type)) { + mixin(createImportsString!Type); + enum QualifiedName = fullyQualifiedName!Type ~ `.` ~ memberName; + static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName))) + && __traits(getProtection, __traits(getMember, instance, memberName)) == "public" + && isFunction!(QualifiedName) + && hasUDA!(__traits(getMember, instance, memberName), PostConstruct)) { + __traits(getMember, instance, memberName)(); + } + } } /**