1 /// Author: Aziz Köksal
2 /// License: GPL3
3 /// $(Maturity very high)
4 module dil.ast.Declaration;
5 
6 import dil.ast.Node;
7 import dil.Enums;
8 
9 /// The root class of all declarations.
10 abstract class Declaration : Node
11 {
12   // Members relevant to semantic phase.
13   StorageClass stcs; /// The storage classes of this declaration.
14   Protection prot;  /// The protection attribute of this declaration.
15 
16   final bool isManifest() @property
17   {
18     return !!(stcs & StorageClass.Manifest);
19   }
20 
21   final bool isStatic() @property
22   {
23     return !!(stcs & StorageClass.Static);
24   }
25 
26   final bool isConst() @property
27   {
28     return !!(stcs & StorageClass.Const);
29   }
30 
31   final bool isPublic() @property
32   {
33     return !!(prot & Protection.Public);
34   }
35 
36   final void setStorageClass(StorageClass stcs)
37   {
38     this.stcs = stcs;
39   }
40 
41   final void setProtection(Protection prot)
42   {
43     this.prot = prot;
44   }
45 
46   override abstract Declaration copy();
47 }