mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Add conditional __compiles check before calling __traits(getOverloads, ...) in AutowiredRegistration.getPreDestructor.
This commit is contained in:
parent
426b1774b8
commit
4f0510d2c9
|
@ -309,12 +309,14 @@ class AutowiredRegistration(RegistrationType : Object) : Registration {
|
|||
private void delegate() getPreDestructor(RegistrationType instance) {
|
||||
void delegate() preDestructor = null;
|
||||
static foreach (memberName; __traits(allMembers, RegistrationType)) {
|
||||
static foreach (overload; __traits(getOverloads, RegistrationType, memberName)) {
|
||||
static if (__traits(compiles, __traits(getProtection, overload))
|
||||
&& __traits(getProtection, overload) == "public"
|
||||
&& isFunction!overload
|
||||
&& hasUDA!(overload, PreDestroy)) {
|
||||
preDestructor = &__traits(getMember, instance, memberName);
|
||||
static if (__traits(compiles, __traits(getOverloads, RegistrationType, memberName))) {
|
||||
static foreach (overload; __traits(getOverloads, RegistrationType, memberName)) {
|
||||
static if (__traits(compiles, __traits(getProtection, overload))
|
||||
&& __traits(getProtection, overload) == "public"
|
||||
&& isFunction!overload
|
||||
&& hasUDA!(overload, PreDestroy)) {
|
||||
preDestructor = &__traits(getMember, instance, memberName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue