1 2 module witchcraft.impl.constructors; 3 4 version(aggressive): 5 6 import witchcraft; 7 8 import std.variant; 9 10 template ConstructorImpl(alias T, size_t overload) 11 { 12 // TODO : Determine this more reliably. 13 static if(__traits(getProtection, __traits(getOverloads, T, "__ctor")[overload]) == "public") 14 { 15 mixin WitchcraftConstructor; 16 17 alias ConstructorImpl = ConstructorMixin!(T, overload); 18 } 19 else 20 { 21 class ConstructorImpl : Constructor 22 { 23 const(Attribute)[] getAttributes() const 24 { 25 assert(0, "Constructor is not accessible."); 26 } 27 28 const(Type) getDeclaringType() const 29 { 30 assert(0, "Constructor is not accessible."); 31 } 32 33 const(TypeInfo) getDeclaringTypeInfo() const 34 { 35 assert(0, "Constructor is not accessible."); 36 } 37 38 string getFullName() const 39 { 40 assert(0, "Constructor is not accessible."); 41 } 42 43 const(Type)[] getParameterTypes() const 44 { 45 assert(0, "Constructor is not accessible."); 46 } 47 48 const(TypeInfo)[] getParameterTypeInfos() const 49 { 50 assert(0, "Constructor is not accessible."); 51 } 52 53 string getProtection() const 54 { 55 return __traits(getProtection, __traits(getOverloads, T, "__ctor")[overload]); 56 } 57 58 const(Type) getReturnType() const 59 { 60 assert(0, "Constructor is not accessible."); 61 } 62 63 @property 64 const(TypeInfo) getReturnTypeInfo() const 65 { 66 assert(0, "Constructor is not accessible."); 67 } 68 69 Variant invoke(Variant instance, Variant[] arguments...) const 70 { 71 assert(0, "Constructor is not accessible."); 72 } 73 74 @property 75 final bool isAccessible() const 76 { 77 return false; 78 } 79 80 @property 81 bool isVarArgs() const 82 { 83 assert(0, "Constructor is not accessible."); 84 } 85 } 86 } 87 }