Mercurial > projects > ldc
comparison dmd/struct.c @ 1195:e961851fb8be
Merged DMD 1.042.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Fri, 03 Apr 2009 17:59:34 +0200 |
parents | 1860414bf3b7 |
children | 78038e540342 |
comparison
equal
deleted
inserted
replaced
1194:1853dcd9b944 | 1195:e961851fb8be |
---|---|
44 #if IN_DMD | 44 #if IN_DMD |
45 stag = NULL; | 45 stag = NULL; |
46 sinit = NULL; | 46 sinit = NULL; |
47 #endif | 47 #endif |
48 scope = NULL; | 48 scope = NULL; |
49 #if V2 | 49 #if DMDV2 |
50 dtor = NULL; | 50 dtor = NULL; |
51 | 51 |
52 ctor = NULL; | 52 ctor = NULL; |
53 defaultCtor = NULL; | 53 defaultCtor = NULL; |
54 #endif | 54 #endif |
164 | 164 |
165 // Check for forward referenced types which will fail the size() call | 165 // Check for forward referenced types which will fail the size() call |
166 Type *t = v->type->toBasetype(); | 166 Type *t = v->type->toBasetype(); |
167 if (t->ty == Tstruct /*&& isStructDeclaration()*/) | 167 if (t->ty == Tstruct /*&& isStructDeclaration()*/) |
168 { TypeStruct *ts = (TypeStruct *)t; | 168 { TypeStruct *ts = (TypeStruct *)t; |
169 #if V2 | 169 #if DMDV2 |
170 if (ts->sym == this) | 170 if (ts->sym == this) |
171 { | 171 { |
172 error("cannot have field %s with same struct type", v->toChars()); | 172 error("cannot have field %s with same struct type", v->toChars()); |
173 } | 173 } |
174 #endif | 174 #endif |
209 | 209 |
210 StructDeclaration::StructDeclaration(Loc loc, Identifier *id) | 210 StructDeclaration::StructDeclaration(Loc loc, Identifier *id) |
211 : AggregateDeclaration(loc, id) | 211 : AggregateDeclaration(loc, id) |
212 { | 212 { |
213 zeroInit = 0; // assume false until we do semantic processing | 213 zeroInit = 0; // assume false until we do semantic processing |
214 #if V2 | 214 #if DMDV2 |
215 hasIdentityAssign = 0; | 215 hasIdentityAssign = 0; |
216 cpctor = NULL; | 216 cpctor = NULL; |
217 postblit = NULL; | 217 postblit = NULL; |
218 #endif | 218 #endif |
219 | 219 |
270 if (sc->stc & STCdeprecated) | 270 if (sc->stc & STCdeprecated) |
271 isdeprecated = 1; | 271 isdeprecated = 1; |
272 assert(!isAnonymous()); | 272 assert(!isAnonymous()); |
273 if (sc->stc & STCabstract) | 273 if (sc->stc & STCabstract) |
274 error("structs, unions cannot be abstract"); | 274 error("structs, unions cannot be abstract"); |
275 #if V2 | 275 #if DMDV2 |
276 if (storage_class & STCinvariant) | 276 if (storage_class & STCinvariant) |
277 type = type->invariantOf(); | 277 type = type->invariantOf(); |
278 else if (storage_class & STCconst) | 278 else if (storage_class & STCconst) |
279 type = type->constOf(); | 279 type = type->constOf(); |
280 #endif | 280 #endif |
368 } | 368 } |
369 } | 369 } |
370 | 370 |
371 id = Id::cmp; | 371 id = Id::cmp; |
372 } | 372 } |
373 #if V2 | 373 #if DMDV2 |
374 dtor = buildDtor(sc2); | 374 dtor = buildDtor(sc2); |
375 postblit = buildPostBlit(sc2); | 375 postblit = buildPostBlit(sc2); |
376 cpctor = buildCpCtor(sc2); | 376 cpctor = buildCpCtor(sc2); |
377 buildOpAssign(sc2); | 377 buildOpAssign(sc2); |
378 #endif | 378 #endif |
436 } | 436 } |
437 } | 437 } |
438 | 438 |
439 /* Look for special member functions. | 439 /* Look for special member functions. |
440 */ | 440 */ |
441 #if V2 | 441 #if DMDV2 |
442 ctor = (CtorDeclaration *)search(0, Id::ctor, 0); | 442 ctor = (CtorDeclaration *)search(0, Id::ctor, 0); |
443 #endif | 443 #endif |
444 inv = (InvariantDeclaration *)search(0, Id::classInvariant, 0); | 444 inv = (InvariantDeclaration *)search(0, Id::classInvariant, 0); |
445 aggNew = (NewDeclaration *)search(0, Id::classNew, 0); | 445 aggNew = (NewDeclaration *)search(0, Id::classNew, 0); |
446 aggDelete = (DeleteDeclaration *)search(0, Id::classDelete, 0); | 446 aggDelete = (DeleteDeclaration *)search(0, Id::classDelete, 0); |