Get member from instance instead

This commit is contained in:
Mike Bierlee 2015-02-28 16:23:52 +01:00
parent 3d6ab10b6d
commit 3f36b63965

View file

@ -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));