From f123109a5e94e094c6945632eb66bae2e41393e9 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sun, 8 Jun 2014 15:56:24 +0200 Subject: [PATCH] Add addresses to debug info when autowiring --- source/poodinis/autowire.d | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index ee26a02..84840e0 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -23,13 +23,16 @@ public void autowire(Type)(Container container, Type instance) { foreach (attribute; mixin(`__traits(getAttributes, Type.` ~ member ~ `)`) ) { if (is(attribute : Autowire) && __traits(getMember, instance, member) is null){ alias TypeTuple!(__traits(getMember, instance, member)) memberReference; + auto autowirableInstance = container.resolve!(typeof(memberReference)); debug { - auto autoWireType = typeid(typeof(memberReference)); - auto memberQualifier = typeid(Type).toString(); - writeln(format("Autowire %s to %s.%s", autoWireType, memberQualifier, member)); + auto autowirableType = typeid(typeof(memberReference[0])); + auto autowireableAddress = &autowirableInstance; + auto memberType = typeid(Type); + auto instanceAddress = &instance; + writeln(format("DEBUG: Autowire instance [%s@%s] to [%s@%s].%s", autowirableType, autowireableAddress, memberType, instanceAddress, member)); } - __traits(getMember, instance, member) = container.resolve!(typeof(memberReference)); + __traits(getMember, instance, member) = autowirableInstance; } } }