1 
2 module witchcraft.methods;
3 
4 import witchcraft;
5 
6 import std..string;
7 
8 /++
9  + Represents and grants access to a single method defined on a type.
10  ++/
11 abstract class Method : Invocable
12 {
13     /++
14      + Checks if this method is declared to be final.
15      +
16      + Returns:
17      +   `true` if the method is final.
18      ++/
19     @property
20     abstract bool isFinal() const;
21 
22     /++
23      + Checks if this method is declared as an override.
24      +
25      + Returns:
26      +   `true` if the method is an override.
27      ++/
28     @property
29     abstract bool isOverride() const;
30 
31     /++
32      + Checks if this method is declared to be static.
33      +
34      + Returns:
35      +   `true` if the method is static.
36      ++/
37     @property
38     abstract bool isStatic() const;
39 
40     /++
41      + Checks if this method has entry in the object's vtable.
42      +
43      + Returns:
44      +   `true` if the method is virtual.
45      +
46      + See_Also:
47      +   isFinal, isStatic
48      ++/
49     @property
50     bool isVirtual() const
51     {
52         return !isFinal && !isStatic;
53     }
54 
55     override string toString() const
56     {
57         return "%s %s(%(%s, %))".format(
58             getReturnTypeInfo, getName, getParameterTypeInfos
59         );
60     }
61 }