Workaround for issue with hasMember and opDispatch

This commit is contained in:
Mergul 2023-04-23 21:52:18 +02:00
parent 3a3a9e0341
commit cd1f81127a

View file

@ -1305,7 +1305,7 @@ export struct EntityManager
// static assert(0, "Add \"mixin ECS.Component;\" in top of component structure;"); // static assert(0, "Add \"mixin ECS.Component;\" in top of component structure;");
// } // }
static if (hasMember!(Comp, "onDestroy") && isFunction!(Comp.onDestroy) static if (__traits(hasMember, Comp.init, "onDestroy") && isFunction!(Comp.onDestroy)
&& is(ReturnType!(Comp.onDestroy) == void) && is(ReturnType!(Comp.onDestroy) == void)
&& Parameters!(Comp.onDestroy).length == 0) && Parameters!(Comp.onDestroy).length == 0)
{ {
@ -1317,7 +1317,7 @@ export struct EntityManager
info.destroy_callback = &callDestroy; info.destroy_callback = &callDestroy;
} }
static if (hasMember!(Comp, "onCreate") && isFunction!(Comp.onCreate) static if (__traits(hasMember, Comp.init, "onCreate") && isFunction!(Comp.onCreate)
&& is(ReturnType!(Comp.onCreate) == void) && Parameters!(Comp.onCreate).length == 0) && is(ReturnType!(Comp.onCreate) == void) && Parameters!(Comp.onCreate).length == 0)
{ {
static void callCreate(void* pointer) nothrow @nogc static void callCreate(void* pointer) nothrow @nogc