Mercurial > projects > ddmd
comparison dmd/TypeAArray.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 |
---|---|
48 { | 48 { |
49 super(Taarray, t); | 49 super(Taarray, t); |
50 this.index = index; | 50 this.index = index; |
51 } | 51 } |
52 | 52 |
53 Type syntaxCopy() | 53 override Type syntaxCopy() |
54 { | 54 { |
55 Type t = next.syntaxCopy(); | 55 Type t = next.syntaxCopy(); |
56 Type ti = index.syntaxCopy(); | 56 Type ti = index.syntaxCopy(); |
57 if (t == next && ti == index) | 57 if (t == next && ti == index) |
58 t = this; | 58 t = this; |
69 Type clone() | 69 Type clone() |
70 { | 70 { |
71 assert(false); | 71 assert(false); |
72 } | 72 } |
73 } | 73 } |
74 ulong size(Loc loc) | 74 override ulong size(Loc loc) |
75 { | 75 { |
76 return PTRSIZE /* * 2*/; | 76 return PTRSIZE /* * 2*/; |
77 } | 77 } |
78 | 78 |
79 Type semantic(Loc loc, Scope sc) | 79 override Type semantic(Loc loc, Scope sc) |
80 { | 80 { |
81 //printf("TypeAArray::semantic() %s index.ty = %d\n", toChars(), index.ty); | 81 //printf("TypeAArray::semantic() %s index.ty = %d\n", toChars(), index.ty); |
82 | 82 |
83 // Deal with the case where we thought the index was a type, but | 83 // Deal with the case where we thought the index was a type, but |
84 // in reality it was an expression. | 84 // in reality it was an expression. |
145 error(loc, "cannot have array of auto %s", next.toChars()); | 145 error(loc, "cannot have array of auto %s", next.toChars()); |
146 | 146 |
147 return merge(); | 147 return merge(); |
148 } | 148 } |
149 | 149 |
150 void resolve(Loc loc, Scope sc, Expression* pe, Type* pt, Dsymbol* ps) | 150 override void resolve(Loc loc, Scope sc, Expression* pe, Type* pt, Dsymbol* ps) |
151 { | 151 { |
152 //printf("TypeAArray.resolve() %s\n", toChars()); | 152 //printf("TypeAArray.resolve() %s\n", toChars()); |
153 | 153 |
154 // Deal with the case where we thought the index was a type, but | 154 // Deal with the case where we thought the index was a type, but |
155 // in reality it was an expression. | 155 // in reality it was an expression. |
173 index.error(loc, "index is not a type or an expression"); | 173 index.error(loc, "index is not a type or an expression"); |
174 } | 174 } |
175 Type.resolve(loc, sc, pe, pt, ps); | 175 Type.resolve(loc, sc, pe, pt, ps); |
176 } | 176 } |
177 | 177 |
178 void toDecoBuffer(OutBuffer buf, int flag) | 178 override void toDecoBuffer(OutBuffer buf, int flag) |
179 { | 179 { |
180 Type.toDecoBuffer(buf, flag); | 180 Type.toDecoBuffer(buf, flag); |
181 index.toDecoBuffer(buf); | 181 index.toDecoBuffer(buf); |
182 next.toDecoBuffer(buf, (flag & 0x100) ? MOD.MODundefined : mod); | 182 next.toDecoBuffer(buf, (flag & 0x100) ? MOD.MODundefined : mod); |
183 } | 183 } |
184 | 184 |
185 void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) | 185 override void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) |
186 { | 186 { |
187 if (mod != this.mod) | 187 if (mod != this.mod) |
188 { | 188 { |
189 toCBuffer3(buf, hgs, mod); | 189 toCBuffer3(buf, hgs, mod); |
190 return; | 190 return; |
193 buf.writeByte('['); | 193 buf.writeByte('['); |
194 index.toCBuffer2(buf, hgs, MODundefined); | 194 index.toCBuffer2(buf, hgs, MODundefined); |
195 buf.writeByte(']'); | 195 buf.writeByte(']'); |
196 } | 196 } |
197 | 197 |
198 Expression dotExp(Scope sc, Expression e, Identifier ident) | 198 override Expression dotExp(Scope sc, Expression e, Identifier ident) |
199 { | 199 { |
200 version (LOGDOTEXP) { | 200 version (LOGDOTEXP) { |
201 printf("TypeAArray.dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); | 201 printf("TypeAArray.dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); |
202 } | 202 } |
203 if (ident == Id.length) | 203 if (ident == Id.length) |
265 e = Type.dotExp(sc, e, ident); | 265 e = Type.dotExp(sc, e, ident); |
266 } | 266 } |
267 return e; | 267 return e; |
268 } | 268 } |
269 | 269 |
270 Expression defaultInit(Loc loc) | 270 override Expression defaultInit(Loc loc) |
271 { | 271 { |
272 version (LOGDEFAULTINIT) { | 272 version (LOGDEFAULTINIT) { |
273 printf("TypeAArray.defaultInit() '%s'\n", toChars()); | 273 printf("TypeAArray.defaultInit() '%s'\n", toChars()); |
274 } | 274 } |
275 Expression e = new NullExp(loc); | 275 Expression e = new NullExp(loc); |
276 e.type = this; | 276 e.type = this; |
277 return e; | 277 return e; |
278 } | 278 } |
279 | 279 |
280 MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) | 280 override MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) |
281 { | 281 { |
282 static if (false) { | 282 static if (false) { |
283 printf("TypeAArray.deduceType()\n"); | 283 printf("TypeAArray.deduceType()\n"); |
284 printf("\tthis = %d, ", ty); print(); | 284 printf("\tthis = %d, ", ty); print(); |
285 printf("\ttparam = %d, ", tparam.ty); tparam.print(); | 285 printf("\ttparam = %d, ", tparam.ty); tparam.print(); |
295 } | 295 } |
296 } | 296 } |
297 return Type.deduceType(sc, tparam, parameters, dedtypes); | 297 return Type.deduceType(sc, tparam, parameters, dedtypes); |
298 } | 298 } |
299 | 299 |
300 bool isZeroInit(Loc loc) | 300 override bool isZeroInit(Loc loc) |
301 { | 301 { |
302 assert(false); | 302 assert(false); |
303 } | 303 } |
304 | 304 |
305 bool checkBoolean() | 305 override bool checkBoolean() |
306 { | 306 { |
307 assert(false); | 307 assert(false); |
308 } | 308 } |
309 | 309 |
310 TypeInfoDeclaration getTypeInfoDeclaration() | 310 override TypeInfoDeclaration getTypeInfoDeclaration() |
311 { | 311 { |
312 return new TypeInfoAssociativeArrayDeclaration(this); | 312 return new TypeInfoAssociativeArrayDeclaration(this); |
313 } | 313 } |
314 | 314 |
315 bool hasPointers() | 315 override bool hasPointers() |
316 { | 316 { |
317 return true; | 317 return true; |
318 } | 318 } |
319 | 319 |
320 MATCH implicitConvTo(Type to) | 320 override MATCH implicitConvTo(Type to) |
321 { | 321 { |
322 //printf("TypeAArray.implicitConvTo(to = %s) this = %s\n", to.toChars(), toChars()); | 322 //printf("TypeAArray.implicitConvTo(to = %s) this = %s\n", to.toChars(), toChars()); |
323 if (equals(to)) | 323 if (equals(to)) |
324 return MATCHexact; | 324 return MATCHexact; |
325 | 325 |
345 } | 345 } |
346 } | 346 } |
347 return Type.implicitConvTo(to); | 347 return Type.implicitConvTo(to); |
348 } | 348 } |
349 | 349 |
350 MATCH constConv(Type to) | 350 override MATCH constConv(Type to) |
351 { | 351 { |
352 assert(false); | 352 assert(false); |
353 } | 353 } |
354 | 354 |
355 version (CPP_MANGLE) { | 355 version (CPP_MANGLE) { |
441 | 441 |
442 sarray.push(s); // remember it | 442 sarray.push(s); // remember it |
443 return s; | 443 return s; |
444 } | 444 } |
445 | 445 |
446 type* toCtype() | 446 override type* toCtype() |
447 { | 447 { |
448 type* t; | 448 type* t; |
449 | 449 |
450 if (ctype) | 450 if (ctype) |
451 return ctype; | 451 return ctype; |