From 3f36b6396594dcfac6726656b31f4e2220c9ba26 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 28 Feb 2015 16:23:52 +0100 Subject: [PATCH] Get member from instance instead --- source/poodinis/autowire.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index 79d5c76..e449afc 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -96,8 +96,8 @@ private void printDebugAutowiringCandidate(TypeInfo candidateInstanceType, void* private void autowireMember(string member, Type)(DependencyContainer container, Type instance) { // For the love of god, refactor this! <-- Doing it, bro! - static if(__traits(compiles, __traits(getMember, Type, member)) && __traits(compiles, __traits(getAttributes, __traits(getMember, Type, member)))) { - foreach(autowireAttribute; __traits(getAttributes, __traits(getMember, Type, member))) { + static if(__traits(compiles, __traits(getMember, instance, member)) && __traits(compiles, __traits(getAttributes, __traits(getMember, instance, member)))) { + foreach(autowireAttribute; __traits(getAttributes, __traits(getMember, instance, member))) { static if (__traits(isSame, autowireAttribute, Autowire) || is(autowireAttribute == Autowire!T, T)) { if (__traits(getMember, instance, member) is null) { alias memberReference = TypeTuple!(__traits(getMember, instance, member));