Mercurial > projects > ldc
comparison dmd/class.c @ 159:5acec6b2eef8 trunk
[svn r175] merged dmd 1.029
author | ChristianK |
---|---|
date | Thu, 01 May 2008 15:15:28 +0200 |
parents | 3cfcb944304e |
children | aaade6ded589 |
comparison
equal
deleted
inserted
replaced
158:287540c5f05e | 159:5acec6b2eef8 |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | 2 // Compiler implementation of the D programming language |
3 // Copyright (c) 1999-2007 by Digital Mars | 3 // Copyright (c) 1999-2008 by Digital Mars |
4 // All Rights Reserved | 4 // All Rights Reserved |
5 // written by Walter Bright | 5 // written by Walter Bright |
6 // http://www.digitalmars.com | 6 // http://www.digitalmars.com |
7 // License for redistribution is by either the Artistic License | 7 // License for redistribution is by either the Artistic License |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | 8 // in artistic.txt, or the GNU General Public License in gnu.txt. |
184 com = 0; | 184 com = 0; |
185 isauto = 0; | 185 isauto = 0; |
186 isabstract = 0; | 186 isabstract = 0; |
187 isnested = 0; | 187 isnested = 0; |
188 vthis = NULL; | 188 vthis = NULL; |
189 inuse = 0; | |
189 } | 190 } |
190 | 191 |
191 Dsymbol *ClassDeclaration::syntaxCopy(Dsymbol *s) | 192 Dsymbol *ClassDeclaration::syntaxCopy(Dsymbol *s) |
192 { | 193 { |
193 ClassDeclaration *cd; | 194 ClassDeclaration *cd; |
640 } | 641 } |
641 structsize = sc->offset; | 642 structsize = sc->offset; |
642 sizeok = 1; | 643 sizeok = 1; |
643 Module::dprogress++; | 644 Module::dprogress++; |
644 | 645 |
646 dtor = buildDtor(sc); | |
645 | 647 |
646 sc->pop(); | 648 sc->pop(); |
647 | 649 |
648 #if 0 // Do not call until toObjfile() because of forward references | 650 #if 0 // Do not call until toObjfile() because of forward references |
649 // Fill in base class vtbl[]s | 651 // Fill in base class vtbl[]s |
972 | 974 |
973 void InterfaceDeclaration::semantic(Scope *sc) | 975 void InterfaceDeclaration::semantic(Scope *sc) |
974 { int i; | 976 { int i; |
975 | 977 |
976 //printf("InterfaceDeclaration::semantic(%s), type = %p\n", toChars(), type); | 978 //printf("InterfaceDeclaration::semantic(%s), type = %p\n", toChars(), type); |
979 if (inuse) | |
980 return; | |
977 if (!scope) | 981 if (!scope) |
978 { type = type->semantic(loc, sc); | 982 { type = type->semantic(loc, sc); |
979 handle = handle->semantic(loc, sc); | 983 handle = handle->semantic(loc, sc); |
980 } | 984 } |
981 if (!members) // if forward reference | 985 if (!members) // if forward reference |
1056 { | 1060 { |
1057 error("circular inheritance of interface"); | 1061 error("circular inheritance of interface"); |
1058 baseclasses.remove(i); | 1062 baseclasses.remove(i); |
1059 continue; | 1063 continue; |
1060 } | 1064 } |
1061 if (!b->base->symtab || b->base->scope) | 1065 if (!b->base->symtab || b->base->scope || b->base->inuse) |
1062 { | 1066 { |
1063 //error("forward reference of base class %s", baseClass->toChars()); | 1067 //error("forward reference of base class %s", baseClass->toChars()); |
1064 // Forward reference of base, try again later | 1068 // Forward reference of base, try again later |
1065 //printf("\ttry later, forward reference of base %s\n", b->base->toChars()); | 1069 //printf("\ttry later, forward reference of base %s\n", b->base->toChars()); |
1066 scope = scx ? scx : new Scope(*sc); | 1070 scope = scx ? scx : new Scope(*sc); |
1121 if (isCOMinterface()) | 1125 if (isCOMinterface()) |
1122 sc->linkage = LINKwindows; | 1126 sc->linkage = LINKwindows; |
1123 sc->structalign = 8; | 1127 sc->structalign = 8; |
1124 structalign = sc->structalign; | 1128 structalign = sc->structalign; |
1125 sc->offset = 8; | 1129 sc->offset = 8; |
1130 inuse++; | |
1126 for (i = 0; i < members->dim; i++) | 1131 for (i = 0; i < members->dim; i++) |
1127 { | 1132 { |
1128 Dsymbol *s = (Dsymbol *)members->data[i]; | 1133 Dsymbol *s = (Dsymbol *)members->data[i]; |
1129 s->semantic(sc); | 1134 s->semantic(sc); |
1130 } | 1135 } |
1136 inuse--; | |
1131 //members->print(); | 1137 //members->print(); |
1132 sc->pop(); | 1138 sc->pop(); |
1133 //printf("-InterfaceDeclaration::semantic(%s), type = %p\n", toChars(), type); | 1139 //printf("-InterfaceDeclaration::semantic(%s), type = %p\n", toChars(), type); |
1134 } | 1140 } |
1135 | 1141 |