Get rid of obsolete member reference

This commit is contained in:
Mike Bierlee 2015-02-28 16:59:50 +01:00
parent 3f36b63965
commit 264f492292

View file

@ -100,8 +100,7 @@ private void autowireMember(string member, Type)(DependencyContainer container,
foreach(autowireAttribute; __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)) { static if (__traits(isSame, autowireAttribute, Autowire) || is(autowireAttribute == Autowire!T, T)) {
if (__traits(getMember, instance, member) is null) { if (__traits(getMember, instance, member) is null) {
alias memberReference = TypeTuple!(__traits(getMember, instance, member)); alias MemberType = typeof(__traits(getMember, instance, member));
alias MemberType = typeof(memberReference)[0];
debug(poodinisVerbose) { debug(poodinisVerbose) {
TypeInfo qualifiedInstanceType = typeid(MemberType); TypeInfo qualifiedInstanceType = typeid(MemberType);
@ -110,12 +109,12 @@ private void autowireMember(string member, Type)(DependencyContainer container,
MemberType qualifiedInstance; MemberType qualifiedInstance;
static if (is(autowireAttribute == Autowire!T, T) && !is(autowireAttribute.qualifier == UseMemberType)) { static if (is(autowireAttribute == Autowire!T, T) && !is(autowireAttribute.qualifier == UseMemberType)) {
alias QualifierType = typeof(autowireAttribute.qualifier); alias QualifierType = typeof(autowireAttribute.qualifier);
qualifiedInstance = container.resolve!(typeof(memberReference), QualifierType); qualifiedInstance = container.resolve!(MemberType, QualifierType);
debug(poodinisVerbose) { debug(poodinisVerbose) {
qualifiedInstanceType = typeid(QualifierType); qualifiedInstanceType = typeid(QualifierType);
} }
} else { } else {
qualifiedInstance = container.resolve!(typeof(memberReference)); qualifiedInstance = container.resolve!(MemberType);
} }
__traits(getMember, instance, member) = qualifiedInstance; __traits(getMember, instance, member) = qualifiedInstance;