Fix always polyfilling isFunction

This commit is contained in:
Mike Bierlee 2021-04-29 01:34:53 +03:00
parent eaac0eb7ce
commit de5fe524a0
3 changed files with 8 additions and 8 deletions

View file

@ -270,7 +270,7 @@ class AutowiredRegistration(RegistrationType : Object) : Registration {
enum QualifiedName = fullyQualifiedName!RegistrationType ~ `.` ~ memberName; enum QualifiedName = fullyQualifiedName!RegistrationType ~ `.` ~ memberName;
static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName))) static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName)))
&& __traits(getProtection, __traits(getMember, instance, memberName)) == "public" && __traits(getProtection, __traits(getMember, instance, memberName)) == "public"
&& isFunction1!(mixin(QualifiedName)) && isFunction!(mixin(QualifiedName))
&& hasUDA!(__traits(getMember, instance, memberName), PreDestroy)) { && hasUDA!(__traits(getMember, instance, memberName), PreDestroy)) {
preDestructor = &__traits(getMember, instance, memberName); preDestructor = &__traits(getMember, instance, memberName);
} }

View file

@ -404,7 +404,7 @@ synchronized class DependencyContainer {
enum QualifiedName = fullyQualifiedName!Type ~ `.` ~ memberName; enum QualifiedName = fullyQualifiedName!Type ~ `.` ~ memberName;
static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName))) static if (__traits(compiles, __traits(getProtection, __traits(getMember, instance, memberName)))
&& __traits(getProtection, __traits(getMember, instance, memberName)) == "public" && __traits(getProtection, __traits(getMember, instance, memberName)) == "public"
&& isFunction1!(mixin(QualifiedName)) && isFunction!(mixin(QualifiedName))
&& hasUDA!(__traits(getMember, instance, memberName), PostConstruct)) { && hasUDA!(__traits(getMember, instance, memberName), PostConstruct)) {
__traits(getMember, instance, memberName)(); __traits(getMember, instance, memberName)();
} }

View file

@ -43,24 +43,24 @@ static if (!__traits(compiles, basicExceptionCtors)) {
} }
} }
static if (!__traits(compiles, isFunction1)) { static if (!__traits(compiles, isFunction)) {
template isFunction1(X...) template isFunction(X...)
{ {
static if (X.length > 1) { static if (X.length > 1) {
enum isFunction1 = false; enum isFunction = false;
} else } else
static if (is(typeof(&X[0]) U : U*) && is(U == function) || static if (is(typeof(&X[0]) U : U*) && is(U == function) ||
is(typeof(&X[0]) U == delegate)) is(typeof(&X[0]) U == delegate))
{ {
// x is a (nested) function symbol. // x is a (nested) function symbol.
enum isFunction1 = true; enum isFunction = true;
} }
else static if (is(X[0] T)) else static if (is(X[0] T))
{ {
// x is a type. Take the type of it and examine. // x is a type. Take the type of it and examine.
enum isFunction1 = is(T == function); enum isFunction = is(T == function);
} }
else else
enum isFunction1 = false; enum isFunction = false;
} }
} }