Use type instead of instance for compatibitlity with old compilers

This commit is contained in:
Mike Bierlee 2023-03-13 21:32:33 +03:00
parent 33b9410354
commit 78f89ccc1f
3 changed files with 3 additions and 3 deletions

View file

@ -309,7 +309,7 @@ class AutowiredRegistration(RegistrationType : Object) : Registration {
private void delegate() getPreDestructor(RegistrationType instance) { private void delegate() getPreDestructor(RegistrationType instance) {
void delegate() preDestructor = null; void delegate() preDestructor = null;
static foreach (memberName; __traits(allMembers, RegistrationType)) { static foreach (memberName; __traits(allMembers, RegistrationType)) {
static foreach (overload; __traits(getOverloads, instance, memberName)) { static foreach (overload; __traits(getOverloads, RegistrationType, memberName)) {
static if (__traits(compiles, __traits(getProtection, overload)) static if (__traits(compiles, __traits(getProtection, overload))
&& __traits(getProtection, overload) == "public" && __traits(getProtection, overload) == "public"
&& isFunction!overload && isFunction!overload

View file

@ -421,7 +421,7 @@ synchronized class DependencyContainer {
private void callPostConstructors(Type)(Type instance) { private void callPostConstructors(Type)(Type instance) {
static foreach (memberName; __traits(allMembers, Type)) { static foreach (memberName; __traits(allMembers, Type)) {
static foreach (overload; __traits(getOverloads, instance, memberName)) { static foreach (overload; __traits(getOverloads, Type, memberName)) {
static if (__traits(compiles, __traits(getProtection, overload)) static if (__traits(compiles, __traits(getProtection, overload))
&& __traits(getProtection, overload) == "public" && __traits(getProtection, overload) == "public"
&& isFunction!overload && isFunction!overload

View file

@ -65,7 +65,7 @@ public void registerContext(Context : ApplicationContext)(shared(DependencyConta
public void registerContextComponents(ApplicationContextType : ApplicationContext)( public void registerContextComponents(ApplicationContextType : ApplicationContext)(
ApplicationContextType context, shared(DependencyContainer) container) { ApplicationContextType context, shared(DependencyContainer) container) {
foreach (memberName; __traits(allMembers, ApplicationContextType)) { foreach (memberName; __traits(allMembers, ApplicationContextType)) {
foreach (overload; __traits(getOverloads, context, memberName)) { foreach (overload; __traits(getOverloads, ApplicationContextType, memberName)) {
static if (__traits(getProtection, overload) == "public" && hasUDA!(overload, Component)) { static if (__traits(getProtection, overload) == "public" && hasUDA!(overload, Component)) {
auto factoryMethod = &__traits(getMember, context, memberName); auto factoryMethod = &__traits(getMember, context, memberName);
Registration registration = null; Registration registration = null;