annotate dmd/StorageClassDeclaration.d @ 72:2e2a5c3f943a

reduced warnings by adding override to the methods think this also normalizes different line endings used all over the place
author Trass3r
date Sat, 28 Aug 2010 16:19:48 +0200
parents b7d29f613539
children 7e0d548de9e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.StorageClassDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import dmd.AttribDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Array;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.TOK;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.Token;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 import dmd.STC;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 class StorageClassDeclaration: AttribDeclaration
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 STC stc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 this(STC stc, Array decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 super(decl);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 this.stc = stc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 51
diff changeset
24 override Dsymbol syntaxCopy(Dsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 {
51
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 0
diff changeset
26 StorageClassDeclaration scd;
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 0
diff changeset
27
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 0
diff changeset
28 assert(!s);
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 0
diff changeset
29 scd = new StorageClassDeclaration(stc, Dsymbol.arraySyntaxCopy(decl));
b7d29f613539 StaticAssertStatement.syntaxCopy
korDen
parents: 0
diff changeset
30 return scd;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 51
diff changeset
33 override void setScope(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 if (decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 STC scstc = sc.stc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 /* These sets of storage classes are mutually exclusive,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 * so choose the innermost or most recent one.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 if (stc & (STC.STCauto | STC.STCscope | STC.STCstatic | STC.STCextern | STC.STCmanifest))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 scstc &= ~(STC.STCauto | STC.STCscope | STC.STCstatic | STC.STCextern | STC.STCmanifest);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 if (stc & (STC.STCauto | STC.STCscope | STC.STCstatic | STC.STCtls | STC.STCmanifest | STC.STCgshared))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 scstc &= ~(STC.STCauto | STC.STCscope | STC.STCstatic | STC.STCtls | STC.STCmanifest | STC.STCgshared);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 if (stc & (STC.STCconst | STC.STCimmutable | STC.STCmanifest))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 scstc &= ~(STC.STCconst | STC.STCimmutable | STC.STCmanifest);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 if (stc & (STC.STCgshared | STC.STCshared | STC.STCtls))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 scstc &= ~(STC.STCgshared | STC.STCshared | STC.STCtls);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 scstc |= stc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 setScopeNewSc(sc, scstc, sc.linkage, sc.protection, sc.explicitProtection, sc.structalign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 51
diff changeset
56 override void semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 if (decl)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 STC scstc = sc.stc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 /* These sets of storage classes are mutually exclusive,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 * so choose the innermost or most recent one.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 if (stc & (STC.STCauto | STC.STCscope | STC.STCstatic | STC.STCextern | STC.STCmanifest))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 scstc &= ~(STC.STCauto | STC.STCscope | STC.STCstatic | STC.STCextern | STC.STCmanifest);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 if (stc & (STC.STCauto | STC.STCscope | STC.STCstatic | STC.STCtls | STC.STCmanifest | STC.STCgshared))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 scstc &= ~(STC.STCauto | STC.STCscope | STC.STCstatic | STC.STCtls | STC.STCmanifest | STC.STCgshared);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 if (stc & (STC.STCconst | STC.STCimmutable | STC.STCmanifest))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 scstc &= ~(STC.STCconst | STC.STCimmutable | STC.STCmanifest);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 if (stc & (STC.STCgshared | STC.STCshared | STC.STCtls))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 scstc &= ~(STC.STCgshared | STC.STCshared | STC.STCtls);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 scstc |= stc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 semanticNewSc(sc, scstc, sc.linkage, sc.protection, sc.explicitProtection, sc.structalign);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 51
diff changeset
79 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 static void stcToCBuffer(OutBuffer buf, int stc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 struct SCstring
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 int stc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 TOK tok;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 };
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 static SCstring[] table =
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 [
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 { STCauto, TOKauto },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 { STCscope, TOKscope },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 { STCstatic, TOKstatic },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 { STCextern, TOKextern },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 { STCconst, TOKconst },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 { STCfinal, TOKfinal },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 { STCabstract, TOKabstract },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 { STCsynchronized, TOKsynchronized },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 { STCdeprecated, TOKdeprecated },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 { STCoverride, TOKoverride },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 { STClazy, TOKlazy },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 { STCalias, TOKalias },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106 { STCout, TOKout },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 { STCin, TOKin },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 /// version (DMDV2) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 /// { STCimmutable, TOKimmutable },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 /// { STCshared, TOKshared },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 /// { STCnothrow, TOKnothrow },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 /// { STCpure, TOKpure },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 /// { STCref, TOKref },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 /// { STCtls, TOKtls },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 /// { STCgshared, TOKgshared },
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 /// }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 ];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 for (int i = 0; i < table.length; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121 if (stc & table[i].stc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 buf.writestring(Token.toChars(table[i].tok));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 buf.writeByte(' ');
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 51
diff changeset
128 }