Fix aliases tripping up UDA discovery

This commit is contained in:
Mike Bierlee 2016-12-17 23:58:37 +01:00
parent 6a1fa7e2c1
commit 3d9a449766
2 changed files with 4 additions and 2 deletions

View file

@ -265,7 +265,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)) { foreach (memberName; __traits(allMembers, RegistrationType)) {
static if (__traits(getProtection, __traits(getMember, instance, memberName)) == "public" static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName)))
&& __traits(getProtection, __traits(getMember, instance, memberName)) == "public"
&& isCallable!(__traits(getMember, instance, memberName)) && isCallable!(__traits(getMember, instance, memberName))
&& hasUDA!(__traits(getMember, instance, memberName), PreDestroy)) { && hasUDA!(__traits(getMember, instance, memberName), PreDestroy)) {
preDestructor = &__traits(getMember, instance, memberName); preDestructor = &__traits(getMember, instance, memberName);

View file

@ -391,7 +391,8 @@ synchronized class DependencyContainer {
private void callPostConstructors(Type)(Type instance) { private void callPostConstructors(Type)(Type instance) {
foreach (memberName; __traits(allMembers, Type)) { foreach (memberName; __traits(allMembers, Type)) {
static if (__traits(getProtection, __traits(getMember, instance, memberName)) == "public" static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName)))
&& __traits(getProtection, __traits(getMember, instance, memberName)) == "public"
&& isCallable!(__traits(getMember, instance, memberName)) && isCallable!(__traits(getMember, instance, memberName))
&& hasUDA!(__traits(getMember, instance, memberName), PostConstruct)) { && hasUDA!(__traits(getMember, instance, memberName), PostConstruct)) {
__traits(getMember, instance, memberName)(); __traits(getMember, instance, memberName)();