Mercurial > projects > ddmd
comparison dmd/TypeClass.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 | 4290d870944a |
children | ef02e2e203c2 |
comparison
equal
deleted
inserted
replaced
71:8e24ef1dd139 | 72:2e2a5c3f943a |
---|---|
76 Type clone() | 76 Type clone() |
77 { | 77 { |
78 assert(false); | 78 assert(false); |
79 } | 79 } |
80 } | 80 } |
81 ulong size(Loc loc) | 81 override ulong size(Loc loc) |
82 { | 82 { |
83 return PTRSIZE; | 83 return PTRSIZE; |
84 } | 84 } |
85 | 85 |
86 string toChars() | 86 override string toChars() |
87 { | 87 { |
88 if (mod) | 88 if (mod) |
89 return Type.toChars(); | 89 return Type.toChars(); |
90 return sym.toPrettyChars(); | 90 return sym.toPrettyChars(); |
91 } | 91 } |
92 | 92 |
93 Type syntaxCopy() | 93 override Type syntaxCopy() |
94 { | 94 { |
95 assert(false); | 95 assert(false); |
96 } | 96 } |
97 | 97 |
98 Type semantic(Loc loc, Scope sc) | 98 override Type semantic(Loc loc, Scope sc) |
99 { | 99 { |
100 //printf("TypeClass.semantic(%s)\n", sym.toChars()); | 100 //printf("TypeClass.semantic(%s)\n", sym.toChars()); |
101 if (deco) | 101 if (deco) |
102 return this; | 102 return this; |
103 //printf("\t%s\n", merge().deco); | 103 //printf("\t%s\n", merge().deco); |
104 return merge(); | 104 return merge(); |
105 } | 105 } |
106 | 106 |
107 Dsymbol toDsymbol(Scope sc) | 107 override Dsymbol toDsymbol(Scope sc) |
108 { | 108 { |
109 return sym; | 109 return sym; |
110 } | 110 } |
111 | 111 |
112 void toDecoBuffer(OutBuffer buf, int flag) | 112 override void toDecoBuffer(OutBuffer buf, int flag) |
113 { | 113 { |
114 string name = sym.mangle(); | 114 string name = sym.mangle(); |
115 //printf("TypeClass.toDecoBuffer('%s' flag=%d mod=%x) = '%s'\n", toChars(), flag, mod, name); | 115 //printf("TypeClass.toDecoBuffer('%s' flag=%d mod=%x) = '%s'\n", toChars(), flag, mod, name); |
116 Type.toDecoBuffer(buf, flag); | 116 Type.toDecoBuffer(buf, flag); |
117 buf.printf("%s", name); | 117 buf.printf("%s", name); |
118 } | 118 } |
119 | 119 |
120 void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) | 120 override void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod) |
121 { | 121 { |
122 if (mod != this.mod) | 122 if (mod != this.mod) |
123 { | 123 { |
124 toCBuffer3(buf, hgs, mod); | 124 toCBuffer3(buf, hgs, mod); |
125 return; | 125 return; |
126 } | 126 } |
127 buf.writestring(sym.toChars()); | 127 buf.writestring(sym.toChars()); |
128 } | 128 } |
129 | 129 |
130 Expression dotExp(Scope sc, Expression e, Identifier ident) | 130 override Expression dotExp(Scope sc, Expression e, Identifier ident) |
131 { | 131 { |
132 uint offset; | 132 uint offset; |
133 | 133 |
134 Expression b; | 134 Expression b; |
135 VarDeclaration v; | 135 VarDeclaration v; |
457 | 457 |
458 DotVarExp de = new DotVarExp(e.loc, e, d); | 458 DotVarExp de = new DotVarExp(e.loc, e, d); |
459 return de.semantic(sc); | 459 return de.semantic(sc); |
460 } | 460 } |
461 | 461 |
462 ClassDeclaration isClassHandle() | 462 override ClassDeclaration isClassHandle() |
463 { | 463 { |
464 return sym; | 464 return sym; |
465 } | 465 } |
466 | 466 |
467 bool isBaseOf(Type t, int* poffset) | 467 override bool isBaseOf(Type t, int* poffset) |
468 { | 468 { |
469 if (t.ty == Tclass) | 469 if (t.ty == Tclass) |
470 { | 470 { |
471 ClassDeclaration cd; | 471 ClassDeclaration cd; |
472 | 472 |
476 } | 476 } |
477 | 477 |
478 return false; | 478 return false; |
479 } | 479 } |
480 | 480 |
481 MATCH implicitConvTo(Type to) | 481 override MATCH implicitConvTo(Type to) |
482 { | 482 { |
483 //printf("TypeClass.implicitConvTo(to = '%s') %s\n", to.toChars(), toChars()); | 483 //printf("TypeClass.implicitConvTo(to = '%s') %s\n", to.toChars(), toChars()); |
484 MATCH m = constConv(to); | 484 MATCH m = constConv(to); |
485 if (m != MATCH.MATCHnomatch) | 485 if (m != MATCH.MATCHnomatch) |
486 return m; | 486 return m; |
512 } | 512 } |
513 | 513 |
514 return m; | 514 return m; |
515 } | 515 } |
516 | 516 |
517 Expression defaultInit(Loc loc) | 517 override Expression defaultInit(Loc loc) |
518 { | 518 { |
519 version (LOGDEFAULTINIT) { | 519 version (LOGDEFAULTINIT) { |
520 printf("TypeClass::defaultInit() '%s'\n", toChars()); | 520 printf("TypeClass::defaultInit() '%s'\n", toChars()); |
521 } | 521 } |
522 Expression e = new NullExp(loc); | 522 Expression e = new NullExp(loc); |
523 e.type = this; | 523 e.type = this; |
524 return e; | 524 return e; |
525 } | 525 } |
526 | 526 |
527 bool isZeroInit(Loc loc) | 527 override bool isZeroInit(Loc loc) |
528 { | 528 { |
529 return true; | 529 return true; |
530 } | 530 } |
531 | 531 |
532 MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) | 532 override MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) |
533 { | 533 { |
534 //printf("TypeClass.deduceType(this = %s)\n", toChars()); | 534 //printf("TypeClass.deduceType(this = %s)\n", toChars()); |
535 | 535 |
536 /* If this class is a template class, and we're matching | 536 /* If this class is a template class, and we're matching |
537 * it against a template instance, convert the class type | 537 * it against a template instance, convert the class type |
578 return implicitConvTo(tp); | 578 return implicitConvTo(tp); |
579 } | 579 } |
580 return Type.deduceType(sc, tparam, parameters, dedtypes); | 580 return Type.deduceType(sc, tparam, parameters, dedtypes); |
581 } | 581 } |
582 | 582 |
583 bool isauto() | 583 override bool isauto() |
584 { | 584 { |
585 return sym.isauto; | 585 return sym.isauto; |
586 } | 586 } |
587 | 587 |
588 bool checkBoolean() | 588 override bool checkBoolean() |
589 { | 589 { |
590 return true; | 590 return true; |
591 } | 591 } |
592 | 592 |
593 TypeInfoDeclaration getTypeInfoDeclaration() | 593 override TypeInfoDeclaration getTypeInfoDeclaration() |
594 { | 594 { |
595 if (sym.isInterfaceDeclaration()) | 595 if (sym.isInterfaceDeclaration()) |
596 return new TypeInfoInterfaceDeclaration(this); | 596 return new TypeInfoInterfaceDeclaration(this); |
597 else | 597 else |
598 return new TypeInfoClassDeclaration(this); | 598 return new TypeInfoClassDeclaration(this); |
599 } | 599 } |
600 | 600 |
601 bool hasPointers() | 601 override bool hasPointers() |
602 { | 602 { |
603 return true; | 603 return true; |
604 } | 604 } |
605 | 605 |
606 bool builtinTypeInfo() | 606 override bool builtinTypeInfo() |
607 { | 607 { |
608 /* This is statically put out with the ClassInfo, so | 608 /* This is statically put out with the ClassInfo, so |
609 * claim it is built in so it isn't regenerated by each module. | 609 * claim it is built in so it isn't regenerated by each module. |
610 */ | 610 */ |
611 version (DMDV2) { | 611 version (DMDV2) { |
614 return true; | 614 return true; |
615 } | 615 } |
616 } | 616 } |
617 | 617 |
618 version (DMDV2) { | 618 version (DMDV2) { |
619 Type toHeadMutable() | 619 override Type toHeadMutable() |
620 { | 620 { |
621 assert(false); | 621 assert(false); |
622 } | 622 } |
623 | 623 |
624 MATCH constConv(Type to) | 624 override MATCH constConv(Type to) |
625 { | 625 { |
626 if (equals(to)) | 626 if (equals(to)) |
627 return MATCH.MATCHexact; | 627 return MATCH.MATCHexact; |
628 | 628 |
629 if (ty == to.ty && sym == (cast(TypeClass)to).sym && to.mod == MOD.MODconst) | 629 if (ty == to.ty && sym == (cast(TypeClass)to).sym && to.mod == MOD.MODconst) |
638 assert(false); | 638 assert(false); |
639 } | 639 } |
640 } | 640 } |
641 } | 641 } |
642 | 642 |
643 type* toCtype() | 643 override type* toCtype() |
644 { | 644 { |
645 type* t; | 645 type* t; |
646 Symbol* s; | 646 Symbol* s; |
647 | 647 |
648 //printf("TypeClass.toCtype() %s\n", toChars()); | 648 //printf("TypeClass.toCtype() %s\n", toChars()); |
685 } | 685 } |
686 | 686 |
687 return t; | 687 return t; |
688 } | 688 } |
689 | 689 |
690 Symbol* toSymbol() | 690 override Symbol* toSymbol() |
691 { | 691 { |
692 return sym.toSymbol(); | 692 return sym.toSymbol(); |
693 } | 693 } |
694 } | 694 } |