Changeset 614
- Timestamp:
- 08/10/10 23:08:57 (14 years ago)
- Files:
-
- trunk/src/struct.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/struct.c
r564 r614 386 386 /* There are problems doing this in the general case because 387 387 * Scope keeps track of things like 'offset' 388 388 */ 389 389 if (s->isEnumDeclaration() || (s->isAggregateDeclaration() && s->ident)) 390 390 { 391 391 //printf("setScope %s %s\n", s->kind(), s->toChars()); 392 392 s->setScope(sc2); 393 393 } 394 394 } 395 395 396 396 for (int i = 0; i < members_dim; i++) 397 397 { 398 398 Dsymbol *s = (Dsymbol *)members->data[i]; 399 399 s->semantic(sc2); 400 400 #if 0 401 401 if (sizeok == 2) 402 402 { //printf("forward reference\n"); 403 403 break; 404 404 } 405 405 #endif 406 407 #if 0 /* Decided to allow this because if the field is initialized by copying it from 408 * a correctly initialized struct, it will work. 409 */ 406 410 Type *t; 407 411 if (s->isDeclaration() && 408 412 (t = s->isDeclaration()->type) != NULL && 409 413 t->toBasetype()->ty == Tstruct) 410 414 { StructDeclaration *sd = (StructDeclaration *)t->toDsymbol(sc); 411 415 if (sd->isnested) 412 error("inner struct %s cannot be a field", sd->toChars()); 413 } 416 error("inner struct %s cannot be the type for field %s as it must embed a reference to its enclosing %s", 417 sd->toChars(), s->toChars(), sd->toParent2()->toPrettyChars()); 418 } 419 #endif 414 420 } 415 421 416 422 #if DMDV1 417 423 /* This doesn't work for DMDV2 because (ref S) and (S) parameter 418 424 * lists will overload the same. 419 425 */ 420 426 /* The TypeInfo_Struct is expecting an opEquals and opCmp with 421 427 * a parameter that is a pointer to the struct. But if there 422 428 * isn't one, but is an opEquals or opCmp with a value, write 423 429 * another that is a shell around the value: 424 430 * int opCmp(struct *p) { return opCmp(*p); } 425 431 */ 426 432 427 433 TypeFunction *tfeqptr; 428 434 { 429 435 Parameters *arguments = new Parameters; 430 436 Parameter *arg = new Parameter(STCin, handle, Id::p, NULL); 431 437 432 438 arguments->push(arg); 433 439 tfeqptr = new TypeFunction(arguments, Type::tint32, 0, LINKd);
