1 
2 module witchcraft.impl.methods;
3 
4 version(aggressive):
5 
6 import witchcraft;
7 
8 import std.variant;
9 
10 template MethodImpl(alias T, string name, size_t overload)
11 {
12     // TODO : Determine this more reliably.
13     static if(__traits(getProtection, __traits(getOverloads, T, name)[overload]) == "public")
14     {
15         mixin WitchcraftMethod;
16 
17         alias MethodImpl = MethodMixin!(T, name, overload);
18     }
19     else
20     {
21         class MethodImpl : Method
22         {
23             const(Attribute)[] getAttributes() const
24             {
25                 assert(0, "Method " ~ name ~ " is inaccessible.");
26             }
27 
28             const(Type) getDeclaringType() const
29             {
30                 assert(0, "Method " ~ name ~ " is inaccessible.");
31             }
32 
33             const(TypeInfo) getDeclaringTypeInfo() const
34             {
35                 assert(0, "Method " ~ name ~ " is inaccessible.");
36             }
37 
38             string getFullName() const
39             {
40                 assert(0, "Method " ~ name ~ " is inaccessible.");
41             }
42 
43             string getName() const
44             {
45                 return name;
46             }
47 
48             const(Type)[] getParameterTypes() const
49             {
50                 assert(0, "Method " ~ name ~ " is inaccessible.");
51             }
52 
53             const(TypeInfo)[] getParameterTypeInfos() const
54             {
55                 assert(0, "Method " ~ name ~ " is inaccessible.");
56             }
57 
58             string getProtection() const
59             {
60                 return __traits(getProtection, __traits(getOverloads, T, name)[overload]);
61             }
62 
63             const(Type) getReturnType() const
64             {
65                 assert(0, "Method " ~ name ~ " is inaccessible.");
66             }
67 
68             @property
69             const(TypeInfo) getReturnTypeInfo() const
70             {
71                 assert(0, "Method " ~ name ~ " is inaccessible.");
72             }
73 
74             Variant invoke(Variant instance, Variant[] arguments...) const
75             {
76                 assert(0, "Method " ~ name ~ " is inaccessible.");
77             }
78 
79             @property
80             final bool isAccessible() const
81             {
82                 return false;
83             }
84 
85             @property
86             override bool isFinal() const
87             {
88                 assert(0, "Method " ~ name ~ " is inaccessible.");
89             }
90 
91             @property
92             override bool isOverride() const
93             {
94                 assert(0, "Method " ~ name ~ " is inaccessible.");
95             }
96 
97             @property
98             override bool isStatic() const
99             {
100                 assert(0, "Method " ~ name ~ " is inaccessible.");
101             }
102 
103             @property
104             bool isVarArgs() const
105             {
106                 assert(0, "Method " ~ name ~ " is inaccessible.");
107             }
108         }
109     }
110 }