mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Add addresses to debug info when autowiring
This commit is contained in:
parent
034837d752
commit
f123109a5e
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue