From 4ebeeb9c9fce13e79c846de6f309cb81ad21728e Mon Sep 17 00:00:00 2001 From: heromyth Date: Sun, 9 Feb 2020 23:43:11 +0800 Subject: [PATCH] isFunction may not work --- source/poodinis/autowire.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index fb5ae01..22d0d29 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -267,9 +267,10 @@ class AutowiredRegistration(RegistrationType : Object) : Registration { void delegate() preDestructor = null; foreach (memberName; __traits(allMembers, RegistrationType)) { mixin(createImportsString!RegistrationType); + enum QualifiedName = fullyQualifiedName!RegistrationType ~ `.` ~ memberName; static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName))) && __traits(getProtection, __traits(getMember, instance, memberName)) == "public" - && isFunction!(mixin(fullyQualifiedName!RegistrationType ~ `.` ~ memberName)) + && isFunction!(QualifiedName) && hasUDA!(__traits(getMember, instance, memberName), PreDestroy)) { preDestructor = &__traits(getMember, instance, memberName); }