Changeset 225
- Timestamp:
- 10/29/09 19:12:35 (15 years ago)
- Files:
-
- trunk/src/declaration.c (modified) (1 diff)
- trunk/src/doc.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/declaration.c
r215 r225 444 444 // for a type or an alias for a symbol. It is up to the semantic() 445 445 // pass to distinguish. 446 446 // If it is a type, then type is set and getType() will return that 447 447 // type. If it is a symbol, then aliassym is set and type is NULL - 448 448 // toAlias() will return aliasssym. 449 449 450 450 Dsymbol *s; 451 451 Type *t; 452 452 Expression *e; 453 453 454 454 /* This section is needed because resolve() will: 455 455 * const x = 3; 456 456 * alias x y; 457 457 * try to alias y to 3. 458 458 */ 459 459 s = type->toDsymbol(sc); 460 460 if (s && ((s->getType() && type->equals(s->getType())) || s->isEnumMember())) 461 461 goto L2; // it's a symbolic alias 462 462 463 463 #if DMDV2 464 if (storage_class & STCref)464 if (storage_class & (STCref | STCnothrow | STCpure)) 465 465 { // For 'ref' to be attached to function types, and picked 466 466 // up by Type::resolve(), it has to go into sc. 467 467 sc = sc->push(); 468 sc->stc |= STCref;468 sc->stc |= storage_class & (STCref | STCnothrow | STCpure); 469 469 type->resolve(loc, sc, &e, &t, &s); 470 470 sc = sc->pop(); 471 471 } 472 472 else 473 473 #endif 474 474 type->resolve(loc, sc, &e, &t, &s); 475 475 if (s) 476 476 { 477 477 goto L2; 478 478 } 479 479 else if (e) 480 480 { 481 481 // Try to convert Expression to Dsymbol 482 482 s = getDsymbol(e); 483 483 if (s) 484 484 goto L2; 485 485 486 486 error("cannot alias an expression %s", e->toChars()); 487 487 t = e->type; 488 488 } trunk/src/doc.c
r195 r225 657 657 hgs.ddoc = 1; 658 658 toCBuffer(buf, &hgs); 659 659 } 660 660 661 661 void prefix(OutBuffer *buf, Dsymbol *s) 662 662 { 663 663 if (s->isDeprecated()) 664 664 buf->writestring("deprecated "); 665 665 Declaration *d = s->isDeclaration(); 666 666 if (d) 667 667 { 668 668 emitProtection(buf, d->protection); 669 669 if (d->isAbstract()) 670 670 buf->writestring("abstract "); 671 671 if (d->isStatic()) 672 672 buf->writestring("static "); 673 673 if (d->isConst()) 674 674 buf->writestring("const "); 675 675 #if DMDV2 676 676 if (d->isInvariant()) 677 buf->writestring("i nvariant");677 buf->writestring("immutable "); 678 678 #endif 679 679 if (d->isFinal()) 680 680 buf->writestring("final "); 681 681 if (d->isSynchronized()) 682 682 buf->writestring("synchronized "); 683 683 } 684 684 } 685 685 686 686 void Declaration::toDocBuffer(OutBuffer *buf) 687 687 { 688 688 //printf("Declaration::toDocbuffer() %s, originalType = %p\n", toChars(), originalType); 689 689 if (ident) 690 690 { 691 691 prefix(buf, this); 692 692 693 693 if (type) 694 694 { HdrGenState hgs; 695 695 hgs.ddoc = 1; 696 696 if (originalType) 697 697 { //originalType->print();
