comparison dmd/TypeSArray.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 f708f0452e81
children 3a0b150c9841 acd69f84627e
comparison
equal deleted inserted replaced
71:8e24ef1dd139 72:2e2a5c3f943a
62 { 62 {
63 assert(false); 63 assert(false);
64 } 64 }
65 } 65 }
66 66
67 Type syntaxCopy() 67 override Type syntaxCopy()
68 { 68 {
69 Type t = next.syntaxCopy(); 69 Type t = next.syntaxCopy();
70 Expression e = dim.syntaxCopy(); 70 Expression e = dim.syntaxCopy();
71 t = new TypeSArray(t, e); 71 t = new TypeSArray(t, e);
72 t.mod = mod; 72 t.mod = mod;
73 return t; 73 return t;
74 } 74 }
75 75
76 ulong size(Loc loc) 76 override ulong size(Loc loc)
77 { 77 {
78 if (!dim) 78 if (!dim)
79 return Type.size(loc); 79 return Type.size(loc);
80 80
81 long sz = dim.toInteger(); 81 long sz = dim.toInteger();
94 Loverflow: 94 Loverflow:
95 error(loc, "index %jd overflow for static array", sz); 95 error(loc, "index %jd overflow for static array", sz);
96 return 1; 96 return 1;
97 } 97 }
98 98
99 uint alignsize() 99 override uint alignsize()
100 { 100 {
101 return next.alignsize(); 101 return next.alignsize();
102 } 102 }
103 103
104 Type semantic(Loc loc, Scope sc) 104 override Type semantic(Loc loc, Scope sc)
105 { 105 {
106 //printf("TypeSArray.semantic() %s\n", toChars()); 106 //printf("TypeSArray.semantic() %s\n", toChars());
107 107
108 Type t; 108 Type t;
109 Expression e; 109 Expression e;
223 if (tbn.isauto()) 223 if (tbn.isauto())
224 error(loc, "cannot have array of auto %s", tbn.toChars()); 224 error(loc, "cannot have array of auto %s", tbn.toChars());
225 return merge(); 225 return merge();
226 } 226 }
227 227
228 void resolve(Loc loc, Scope sc, Expression* pe, Type* pt, Dsymbol* ps) 228 override void resolve(Loc loc, Scope sc, Expression* pe, Type* pt, Dsymbol* ps)
229 { 229 {
230 //printf("TypeSArray.resolve() %s\n", toChars()); 230 //printf("TypeSArray.resolve() %s\n", toChars());
231 next.resolve(loc, sc, pe, pt, ps); 231 next.resolve(loc, sc, pe, pt, ps);
232 //printf("s = %p, e = %p, t = %p\n", *ps, *pe, *pt); 232 //printf("s = %p, e = %p, t = %p\n", *ps, *pe, *pt);
233 if (*pe) 233 if (*pe)
287 Ldefault: 287 Ldefault:
288 Type.resolve(loc, sc, pe, pt, ps); 288 Type.resolve(loc, sc, pe, pt, ps);
289 } 289 }
290 } 290 }
291 291
292 void toDecoBuffer(OutBuffer buf, int flag) 292 override void toDecoBuffer(OutBuffer buf, int flag)
293 { 293 {
294 Type.toDecoBuffer(buf, flag); 294 Type.toDecoBuffer(buf, flag);
295 if (dim) 295 if (dim)
296 //buf.printf("%ju", dim.toInteger()); /// 296 //buf.printf("%ju", dim.toInteger()); ///
297 buf.printf("%s", dim.toInteger()); 297 buf.printf("%s", dim.toInteger());
302 * not the [4]. 302 * not the [4].
303 */ 303 */
304 next.toDecoBuffer(buf, (flag & 0x100) ? flag : mod); 304 next.toDecoBuffer(buf, (flag & 0x100) ? flag : mod);
305 } 305 }
306 306
307 void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) 307 override void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod)
308 { 308 {
309 if (mod != this.mod) 309 if (mod != this.mod)
310 { 310 {
311 toCBuffer3(buf, hgs, mod); 311 toCBuffer3(buf, hgs, mod);
312 return; 312 return;
313 } 313 }
314 next.toCBuffer2(buf, hgs, this.mod); 314 next.toCBuffer2(buf, hgs, this.mod);
315 buf.printf("[%s]", dim.toChars()); 315 buf.printf("[%s]", dim.toChars());
316 } 316 }
317 317
318 Expression dotExp(Scope sc, Expression e, Identifier ident) 318 override Expression dotExp(Scope sc, Expression e, Identifier ident)
319 { 319 {
320 version (LOGDOTEXP) { 320 version (LOGDOTEXP) {
321 printf("TypeSArray.dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars()); 321 printf("TypeSArray.dotExp(e = '%s', ident = '%s')\n", e.toChars(), ident.toChars());
322 } 322 }
323 if (ident == Id.length) 323 if (ident == Id.length)
333 e = TypeArray.dotExp(sc, e, ident); 333 e = TypeArray.dotExp(sc, e, ident);
334 } 334 }
335 return e; 335 return e;
336 } 336 }
337 337
338 bool isString() 338 override bool isString()
339 { 339 {
340 TY nty = next.toBasetype().ty; 340 TY nty = next.toBasetype().ty;
341 return nty == Tchar || nty == Twchar || nty == Tdchar; 341 return nty == Tchar || nty == Twchar || nty == Tdchar;
342 } 342 }
343 343
344 bool isZeroInit(Loc loc) 344 override bool isZeroInit(Loc loc)
345 { 345 {
346 return next.isZeroInit(loc); 346 return next.isZeroInit(loc);
347 } 347 }
348 348
349 uint memalign(uint salign) 349 override uint memalign(uint salign)
350 { 350 {
351 return next.memalign(salign); 351 return next.memalign(salign);
352 } 352 }
353 353
354 MATCH constConv(Type to) 354 override MATCH constConv(Type to)
355 { 355 {
356 assert(false); 356 assert(false);
357 } 357 }
358 358
359 MATCH implicitConvTo(Type to) 359 override MATCH implicitConvTo(Type to)
360 { 360 {
361 //printf("TypeSArray.implicitConvTo(to = %s) this = %s\n", to.toChars(), toChars()); 361 //printf("TypeSArray.implicitConvTo(to = %s) this = %s\n", to.toChars(), toChars());
362 362
363 // Allow implicit conversion of static array to pointer or dynamic array 363 // Allow implicit conversion of static array to pointer or dynamic array
364 if (IMPLICIT_ARRAY_TO_PTR && to.ty == Tpointer) 364 if (IMPLICIT_ARRAY_TO_PTR && to.ty == Tpointer)
415 } 415 }
416 } 416 }
417 return MATCHnomatch; 417 return MATCHnomatch;
418 } 418 }
419 419
420 Expression defaultInit(Loc loc) 420 override Expression defaultInit(Loc loc)
421 { 421 {
422 version (LOGDEFAULTINIT) { 422 version (LOGDEFAULTINIT) {
423 printf("TypeSArray.defaultInit() '%s'\n", toChars()); 423 printf("TypeSArray.defaultInit() '%s'\n", toChars());
424 } 424 }
425 return next.defaultInit(loc); 425 return next.defaultInit(loc);
426 } 426 }
427 427
428 dt_t** toDt(dt_t** pdt) 428 override dt_t** toDt(dt_t** pdt)
429 { 429 {
430 return toDtElem(pdt, null); 430 return toDtElem(pdt, null);
431 } 431 }
432 432
433 dt_t** toDtElem(dt_t** pdt, Expression e) 433 dt_t** toDtElem(dt_t** pdt, Expression e)
484 } 484 }
485 } 485 }
486 return pdt; 486 return pdt;
487 } 487 }
488 488
489 MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) 489 override MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes)
490 { 490 {
491 static if (false) { 491 static if (false) {
492 printf("TypeSArray.deduceType()\n"); 492 printf("TypeSArray.deduceType()\n");
493 printf("\tthis = %d, ", ty); print(); 493 printf("\tthis = %d, ", ty); print();
494 printf("\ttparam = %d, ", tparam.ty); tparam.print(); 494 printf("\ttparam = %d, ", tparam.ty); tparam.print();
579 579
580 Lnomatch: 580 Lnomatch:
581 return MATCHnomatch; 581 return MATCHnomatch;
582 } 582 }
583 583
584 TypeInfoDeclaration getTypeInfoDeclaration() 584 override TypeInfoDeclaration getTypeInfoDeclaration()
585 { 585 {
586 return new TypeInfoStaticArrayDeclaration(this); 586 return new TypeInfoStaticArrayDeclaration(this);
587 } 587 }
588 588
589 Expression toExpression() 589 override Expression toExpression()
590 { 590 {
591 assert(false); 591 assert(false);
592 } 592 }
593 593
594 bool hasPointers() 594 override bool hasPointers()
595 { 595 {
596 return next.hasPointers(); 596 return next.hasPointers();
597 } 597 }
598 598
599 version (CPP_MANGLE) { 599 version (CPP_MANGLE) {
601 { 601 {
602 assert(false); 602 assert(false);
603 } 603 }
604 } 604 }
605 605
606 type* toCtype() 606 override type* toCtype()
607 { 607 {
608 if (!ctype) 608 if (!ctype)
609 { 609 {
610 type* tn = next.toCtype(); 610 type* tn = next.toCtype();
611 ctype = type_allocn(TYarray, tn); 611 ctype = type_allocn(TYarray, tn);
613 } 613 }
614 614
615 return ctype; 615 return ctype;
616 } 616 }
617 617
618 type* toCParamtype() 618 override type* toCParamtype()
619 { 619 {
620 // arrays are passed as pointers 620 // arrays are passed as pointers
621 return next.pointerTo().toCtype(); 621 return next.pointerTo().toCtype();
622 } 622 }
623 } 623 }