Mercurial > projects > ldc
comparison dmd/class.c @ 336:aaade6ded589 trunk
[svn r357] Merged DMD 1.033
author | lindquist |
---|---|
date | Sat, 12 Jul 2008 19:38:31 +0200 |
parents | 5acec6b2eef8 |
children | 50383e476c7e |
comparison
equal
deleted
inserted
replaced
335:17b844102023 | 336:aaade6ded589 |
---|---|
145 { if (Type::typeinfotypelist) | 145 { if (Type::typeinfotypelist) |
146 Type::typeinfotypelist->error("%s", msg); | 146 Type::typeinfotypelist->error("%s", msg); |
147 Type::typeinfotypelist = this; | 147 Type::typeinfotypelist = this; |
148 } | 148 } |
149 | 149 |
150 #if V2 | 150 #if DMDV2 |
151 if (id == Id::TypeInfo_Const) | 151 if (id == Id::TypeInfo_Const) |
152 { if (Type::typeinfoconst) | 152 { if (Type::typeinfoconst) |
153 Type::typeinfoconst->error("%s", msg); | 153 Type::typeinfoconst->error("%s", msg); |
154 Type::typeinfoconst = this; | 154 Type::typeinfoconst = this; |
155 } | 155 } |
259 #ifdef IN_GCC | 259 #ifdef IN_GCC |
260 methods.setDim(0); | 260 methods.setDim(0); |
261 #endif | 261 #endif |
262 | 262 |
263 if (sc->stc & STCdeprecated) | 263 if (sc->stc & STCdeprecated) |
264 { //printf("test1: %s is deprecated\n", toChars()); | 264 { |
265 isdeprecated = 1; | 265 isdeprecated = 1; |
266 } | 266 } |
267 | 267 |
268 // Expand any tuples in baseclasses[] | 268 // Expand any tuples in baseclasses[] |
269 for (i = 0; i < baseclasses.dim; ) | 269 for (i = 0; i < baseclasses.dim; ) |
300 baseclasses.remove(0); | 300 baseclasses.remove(0); |
301 } | 301 } |
302 else | 302 else |
303 { | 303 { |
304 tc = (TypeClass *)(tb); | 304 tc = (TypeClass *)(tb); |
305 | |
305 if (tc->sym->isDeprecated()) | 306 if (tc->sym->isDeprecated()) |
306 { | 307 { |
307 if (!isDeprecated()) | 308 if (!isDeprecated()) |
308 { | 309 { |
309 // Deriving from deprecated class makes this one deprecated too | 310 // Deriving from deprecated class makes this one deprecated too |
563 | 564 |
564 scope = scx ? scx : new Scope(*sc); | 565 scope = scx ? scx : new Scope(*sc); |
565 scope->setNoFree(); | 566 scope->setNoFree(); |
566 scope->module->addDeferredSemantic(this); | 567 scope->module->addDeferredSemantic(this); |
567 | 568 |
568 //printf("\tsemantic('%s') failed\n", toChars()); | 569 //printf("\tsemantic('%s') failed due to forward references\n", toChars()); |
569 return; | 570 return; |
570 } | 571 } |
571 | 572 |
572 //printf("\tsemantic('%s') successful\n", toChars()); | 573 //printf("\tsemantic('%s') successful\n", toChars()); |
573 | 574 |
597 // a constructor: | 598 // a constructor: |
598 // this() { } | 599 // this() { } |
599 if (!ctor && baseClass && baseClass->ctor) | 600 if (!ctor && baseClass && baseClass->ctor) |
600 { | 601 { |
601 //printf("Creating default this(){} for class %s\n", toChars()); | 602 //printf("Creating default this(){} for class %s\n", toChars()); |
602 ctor = new CtorDeclaration(0, 0, NULL, 0); | 603 ctor = new CtorDeclaration(loc, 0, NULL, 0); |
603 ctor->fbody = new CompoundStatement(0, new Statements()); | 604 ctor->fbody = new CompoundStatement(0, new Statements()); |
604 members->push(ctor); | 605 members->push(ctor); |
605 ctor->addMember(sc, this, 1); | 606 ctor->addMember(sc, this, 1); |
606 *sc = scsave; // why? What about sc->nofree? | 607 *sc = scsave; // why? What about sc->nofree? |
607 sc->offset = structsize; | 608 sc->offset = structsize; |
794 /********************************************************** | 795 /********************************************************** |
795 * fd is in the vtbl[] for this class. | 796 * fd is in the vtbl[] for this class. |
796 * Return 1 if function is hidden (not findable through search). | 797 * Return 1 if function is hidden (not findable through search). |
797 */ | 798 */ |
798 | 799 |
799 #if V2 | 800 #if DMDV2 |
800 int isf(void *param, FuncDeclaration *fd) | 801 int isf(void *param, FuncDeclaration *fd) |
801 { | 802 { |
802 //printf("param = %p, fd = %p %s\n", param, fd, fd->toChars()); | 803 //printf("param = %p, fd = %p %s\n", param, fd, fd->toChars()); |
803 return param == fd; | 804 return param == fd; |
804 } | 805 } |
855 | 856 |
856 return NULL; | 857 return NULL; |
857 } | 858 } |
858 | 859 |
859 void ClassDeclaration::interfaceSemantic(Scope *sc) | 860 void ClassDeclaration::interfaceSemantic(Scope *sc) |
860 { int i; | 861 { |
861 | |
862 vtblInterfaces = new BaseClasses(); | 862 vtblInterfaces = new BaseClasses(); |
863 vtblInterfaces->reserve(interfaces_dim); | 863 vtblInterfaces->reserve(interfaces_dim); |
864 | 864 |
865 for (i = 0; i < interfaces_dim; i++) | 865 for (size_t i = 0; i < interfaces_dim; i++) |
866 { | 866 { |
867 BaseClass *b = interfaces[i]; | 867 BaseClass *b = interfaces[i]; |
868 | 868 |
869 // If this is an interface, and it derives from a COM interface, | 869 // If this is an interface, and it derives from a COM interface, |
870 // then this is a COM interface too. | 870 // then this is a COM interface too. |
908 return TRUE; | 908 return TRUE; |
909 } | 909 } |
910 } | 910 } |
911 return FALSE; | 911 return FALSE; |
912 } | 912 } |
913 | |
913 | 914 |
914 /**************************************** | 915 /**************************************** |
915 * Returns !=0 if there's an extra member which is the 'this' | 916 * Returns !=0 if there's an extra member which is the 'this' |
916 * pointer to the enclosing context (enclosing class or function) | 917 * pointer to the enclosing context (enclosing class or function) |
917 */ | 918 */ |
934 } | 935 } |
935 | 936 |
936 /**************************************** | 937 /**************************************** |
937 */ | 938 */ |
938 | 939 |
939 char *ClassDeclaration::kind() | 940 const char *ClassDeclaration::kind() |
940 { | 941 { |
941 return "class"; | 942 return "class"; |
942 } | 943 } |
943 | 944 |
944 /**************************************** | 945 /**************************************** |
1232 } | 1233 } |
1233 | 1234 |
1234 /******************************************* | 1235 /******************************************* |
1235 */ | 1236 */ |
1236 | 1237 |
1237 char *InterfaceDeclaration::kind() | 1238 const char *InterfaceDeclaration::kind() |
1238 { | 1239 { |
1239 return "interface"; | 1240 return "interface"; |
1240 } | 1241 } |
1241 | 1242 |
1242 | 1243 |