Mercurial > projects > ddmd
comparison dmd/TypeEnum.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 | ee3a9f34dc48 |
children | ef02e2e203c2 |
comparison
equal
deleted
inserted
replaced
71:8e24ef1dd139 | 72:2e2a5c3f943a |
---|---|
39 Type clone() | 39 Type clone() |
40 { | 40 { |
41 assert(false); | 41 assert(false); |
42 } | 42 } |
43 } | 43 } |
44 Type syntaxCopy() | 44 override Type syntaxCopy() |
45 { | 45 { |
46 assert(false); | 46 assert(false); |
47 } | 47 } |
48 | 48 |
49 ulong size(Loc loc) | 49 override ulong size(Loc loc) |
50 { | 50 { |
51 if (!sym.memtype) | 51 if (!sym.memtype) |
52 { | 52 { |
53 error(loc, "enum %s is forward referenced", sym.toChars()); | 53 error(loc, "enum %s is forward referenced", sym.toChars()); |
54 return 4; | 54 return 4; |
55 } | 55 } |
56 return sym.memtype.size(loc); | 56 return sym.memtype.size(loc); |
57 } | 57 } |
58 | 58 |
59 uint alignsize() | 59 override uint alignsize() |
60 { | 60 { |
61 assert(false); | 61 assert(false); |
62 } | 62 } |
63 | 63 |
64 string toChars() | 64 override string toChars() |
65 { | 65 { |
66 assert(false); | 66 assert(false); |
67 } | 67 } |
68 | 68 |
69 Type semantic(Loc loc, Scope sc) | 69 override Type semantic(Loc loc, Scope sc) |
70 { | 70 { |
71 //printf("TypeEnum::semantic() %s\n", toChars()); | 71 //printf("TypeEnum::semantic() %s\n", toChars()); |
72 //sym.semantic(sc); | 72 //sym.semantic(sc); |
73 return merge(); | 73 return merge(); |
74 } | 74 } |
75 | 75 |
76 Dsymbol toDsymbol(Scope sc) | 76 override Dsymbol toDsymbol(Scope sc) |
77 { | 77 { |
78 return sym; | 78 return sym; |
79 } | 79 } |
80 | 80 |
81 void toDecoBuffer(OutBuffer buf, int flag) | 81 override void toDecoBuffer(OutBuffer buf, int flag) |
82 { | 82 { |
83 string name = sym.mangle(); | 83 string name = sym.mangle(); |
84 Type.toDecoBuffer(buf, flag); | 84 Type.toDecoBuffer(buf, flag); |
85 buf.printf("%s", name); | 85 buf.printf("%s", name); |
86 } | 86 } |
87 | 87 |
88 void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) | 88 override void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) |
89 { | 89 { |
90 if (mod != this.mod) | 90 if (mod != this.mod) |
91 { | 91 { |
92 toCBuffer3(buf, hgs, mod); | 92 toCBuffer3(buf, hgs, mod); |
93 return; | 93 return; |
94 } | 94 } |
95 buf.writestring(sym.toChars()); | 95 buf.writestring(sym.toChars()); |
96 } | 96 } |
97 | 97 |
98 Expression dotExp(Scope sc, Expression e, Identifier ident) | 98 override Expression dotExp(Scope sc, Expression e, Identifier ident) |
99 { | 99 { |
100 version (LOGDOTEXP) { | 100 version (LOGDOTEXP) { |
101 printf("TypeEnum::dotExp(e = '%s', ident = '%s') '%s'\n", e.toChars(), ident.toChars(), toChars()); | 101 printf("TypeEnum::dotExp(e = '%s', ident = '%s') '%s'\n", e.toChars(), ident.toChars(), toChars()); |
102 } | 102 } |
103 Dsymbol s = sym.search(e.loc, ident, 0); | 103 Dsymbol s = sym.search(e.loc, ident, 0); |
120 Expression em = m.value.copy(); | 120 Expression em = m.value.copy(); |
121 em.loc = e.loc; | 121 em.loc = e.loc; |
122 return em; | 122 return em; |
123 } | 123 } |
124 | 124 |
125 Expression getProperty(Loc loc, Identifier ident) | 125 override Expression getProperty(Loc loc, Identifier ident) |
126 { | 126 { |
127 assert(false); | 127 assert(false); |
128 } | 128 } |
129 | 129 |
130 bool isintegral() | 130 override bool isintegral() |
131 { | 131 { |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 bool isfloating() | 135 override bool isfloating() |
136 { | 136 { |
137 return false; | 137 return false; |
138 } | 138 } |
139 | 139 |
140 bool isscalar() | 140 override bool isscalar() |
141 { | 141 { |
142 return true; | 142 return true; |
143 //return sym.memtype.isscalar(); | 143 //return sym.memtype.isscalar(); |
144 } | 144 } |
145 | 145 |
146 bool isunsigned() | 146 override bool isunsigned() |
147 { | 147 { |
148 return sym.memtype.isunsigned(); | 148 return sym.memtype.isunsigned(); |
149 } | 149 } |
150 | 150 |
151 MATCH implicitConvTo(Type to) | 151 override MATCH implicitConvTo(Type to) |
152 { | 152 { |
153 MATCH m; | 153 MATCH m; |
154 | 154 |
155 //printf("TypeEnum::implicitConvTo()\n"); | 155 //printf("TypeEnum::implicitConvTo()\n"); |
156 if (ty == to.ty && sym == (cast(TypeEnum)to).sym) | 156 if (ty == to.ty && sym == (cast(TypeEnum)to).sym) |
160 else | 160 else |
161 m = MATCHnomatch; // no match | 161 m = MATCHnomatch; // no match |
162 return m; | 162 return m; |
163 } | 163 } |
164 | 164 |
165 MATCH constConv(Type to) | 165 override MATCH constConv(Type to) |
166 { | 166 { |
167 assert(false); | 167 assert(false); |
168 } | 168 } |
169 | 169 |
170 Type toBasetype() | 170 override Type toBasetype() |
171 { | 171 { |
172 if (!sym.memtype) | 172 if (!sym.memtype) |
173 { | 173 { |
174 debug writef("2: "); | 174 debug writef("2: "); |
175 error(sym.loc, "enum %s is forward referenced", sym.toChars()); | 175 error(sym.loc, "enum %s is forward referenced", sym.toChars()); |
177 } | 177 } |
178 | 178 |
179 return sym.memtype.toBasetype(); | 179 return sym.memtype.toBasetype(); |
180 } | 180 } |
181 | 181 |
182 Expression defaultInit(Loc loc) | 182 override Expression defaultInit(Loc loc) |
183 { | 183 { |
184 version (LOGDEFAULTINIT) { | 184 version (LOGDEFAULTINIT) { |
185 printf("TypeEnum::defaultInit() '%s'\n", toChars()); | 185 printf("TypeEnum::defaultInit() '%s'\n", toChars()); |
186 } | 186 } |
187 // Initialize to first member of enum | 187 // Initialize to first member of enum |
192 return new ErrorExp(); | 192 return new ErrorExp(); |
193 } | 193 } |
194 return sym.defaultval; | 194 return sym.defaultval; |
195 } | 195 } |
196 | 196 |
197 bool isZeroInit(Loc loc) | 197 override bool isZeroInit(Loc loc) |
198 { | 198 { |
199 if (!sym.defaultval) | 199 if (!sym.defaultval) |
200 { | 200 { |
201 debug writef("3: "); | 201 debug writef("3: "); |
202 error(loc, "enum %s is forward referenced", sym.toChars()); | 202 error(loc, "enum %s is forward referenced", sym.toChars()); |
203 return 0; | 203 return 0; |
204 } | 204 } |
205 return sym.defaultval.isBool(false); | 205 return sym.defaultval.isBool(false); |
206 } | 206 } |
207 | 207 |
208 MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) | 208 override MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) |
209 { | 209 { |
210 assert(false); | 210 assert(false); |
211 } | 211 } |
212 | 212 |
213 TypeInfoDeclaration getTypeInfoDeclaration() | 213 override TypeInfoDeclaration getTypeInfoDeclaration() |
214 { | 214 { |
215 return new TypeInfoEnumDeclaration(this); | 215 return new TypeInfoEnumDeclaration(this); |
216 } | 216 } |
217 | 217 |
218 bool hasPointers() | 218 override bool hasPointers() |
219 { | 219 { |
220 return toBasetype().hasPointers(); | 220 return toBasetype().hasPointers(); |
221 } | 221 } |
222 | 222 |
223 version (CPP_MANGLE) { | 223 version (CPP_MANGLE) { |
225 { | 225 { |
226 assert(false); | 226 assert(false); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 type* toCtype() | 230 override type* toCtype() |
231 { | 231 { |
232 return sym.memtype.toCtype(); | 232 return sym.memtype.toCtype(); |
233 } | 233 } |
234 } | 234 } |