Changeset 776
- Timestamp:
- 12/05/10 04:09:44 (14 years ago)
- Files:
-
- trunk/src/class.c (modified) (1 diff)
- trunk/src/struct.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/class.c
r650 r776 553 554 } 554 555 else 555 556 assert(0); 556 557 if (t->ty == Tstruct) // ref to struct 557 558 t = Type::tvoidptr; 558 559 assert(!vthis); 559 560 vthis = new ThisDeclaration(loc, t); 560 561 members->push(vthis); 561 562 } 562 563 } 563 564 } 564 565 } 565 566 566 567 if (storage_class & STCauto) 567 568 error("storage class 'auto' is invalid when declaring a class, did you mean to use 'scope'?"); 568 569 if (storage_class & STCscope) 569 570 isscope = 1; 570 571 if (storage_class & STCabstract) 571 572 isabstract = 1; 572 573 if (storage_class & STCimmutable) 573 type = type-> invariantOf();574 elseif (storage_class & STCconst)575 type = type-> constOf();576 elseif (storage_class & STCshared)577 type = type-> sharedOf();574 type = type->addMod(MODimmutable); 575 if (storage_class & STCconst) 576 type = type->addMod(MODconst); 577 if (storage_class & STCshared) 578 type = type->addMod(MODshared); 578 579 579 580 sc = sc->push(this); 580 581 sc->stc &= ~(STCfinal | STCauto | STCscope | STCstatic | 581 582 STCabstract | STCdeprecated | STC_TYPECTOR | STCtls | STCgshared); 582 583 sc->stc |= storage_class & STC_TYPECTOR; 583 584 sc->parent = this; 584 585 sc->inunion = 0; 585 586 586 587 if (isCOMclass()) 587 588 { 588 589 #if _WIN32 589 590 sc->linkage = LINKwindows; 590 591 #else 591 592 /* This enables us to use COM objects under Linux and 592 593 * work with things like XPCOM 593 594 */ 594 595 sc->linkage = LINKc; 595 596 #endif 596 597 } 597 598 sc->protection = PROTpublic; trunk/src/struct.c
r719 r776 300 300 301 301 unsigned dprogress_save = Module::dprogress; 302 302 303 303 parent = sc->parent; 304 304 type = type->semantic(loc, sc); 305 305 #if STRUCTTHISREF 306 306 handle = type; 307 307 #else 308 308 handle = type->pointerTo(); 309 309 #endif 310 310 structalign = sc->structalign; 311 311 protection = sc->protection; 312 312 storage_class |= sc->stc; 313 313 if (sc->stc & STCdeprecated) 314 314 isdeprecated = 1; 315 315 assert(!isAnonymous()); 316 316 if (sc->stc & STCabstract) 317 317 error("structs, unions cannot be abstract"); 318 318 #if DMDV2 319 319 if (storage_class & STCimmutable) 320 type = type-> invariantOf();321 elseif (storage_class & STCconst)322 type = type-> constOf();323 elseif (storage_class & STCshared)324 type = type-> sharedOf();320 type = type->addMod(MODimmutable); 321 if (storage_class & STCconst) 322 type = type->addMod(MODconst); 323 if (storage_class & STCshared) 324 type = type->addMod(MODshared); 325 325 #endif 326 326 327 327 if (sizeok == 0) // if not already done the addMember step 328 328 { 329 329 int hasfunctions = 0; 330 330 for (int i = 0; i < members->dim; i++) 331 331 { 332 332 Dsymbol *s = (Dsymbol *)members->data[i]; 333 333 //printf("adding member '%s' to '%s'\n", s->toChars(), this->toChars()); 334 334 s->addMember(sc, this, 1); 335 335 if (s->isFuncDeclaration()) 336 336 hasfunctions = 1; 337 337 } 338 338 339 339 // If nested struct, add in hidden 'this' pointer to outer scope 340 340 if (hasfunctions && !(storage_class & STCstatic)) 341 341 { Dsymbol *s = toParent2(); 342 342 if (s) 343 343 { 344 344 AggregateDeclaration *ad = s->isAggregateDeclaration();
