All the unittests passed

This commit is contained in:
heromyth 2020-02-11 10:19:08 +08:00
parent 15d8c7e754
commit 55726e84db
3 changed files with 10 additions and 7 deletions

View file

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

View file

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

View file

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