Changeset 607
- Timestamp:
- 08/09/10 04:30:47 (14 years ago)
- Files:
-
- branches/dmd-1.x/src/declaration.c (modified) (1 diff)
- trunk/src/declaration.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/declaration.c
r517 r607 599 599 { 600 600 //printf("AliasDeclaration::getType() %s\n", type->toChars()); 601 601 #if 0 602 602 if (!type->deco && scope) 603 603 semantic(scope); 604 604 if (type && !type->deco) 605 605 error("forward reference to alias %s\n", toChars()); 606 606 #endif 607 607 return type; 608 608 } 609 609 610 610 Dsymbol *AliasDeclaration::toAlias() 611 611 { 612 612 //printf("AliasDeclaration::toAlias('%s', this = %p, aliassym = %p, kind = '%s')\n", toChars(), this, aliassym, aliassym ? aliassym->kind() : ""); 613 613 assert(this != aliassym); 614 614 //static int count; if (++count == 75) exit(0); //*(char*)0=0; 615 615 if (inSemantic) 616 616 { error("recursive alias declaration"); 617 617 aliassym = new TypedefDeclaration(loc, ident, Type::terror, NULL); 618 618 } 619 else if (!aliassym && scope) 620 semantic(scope); 619 621 Dsymbol *s = aliassym ? aliassym->toAlias() : this; 620 622 return s; 621 623 } 622 624 623 625 void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) 624 626 { 625 627 buf->writestring("alias "); 626 628 #if 0 && _DH 627 629 if (hgs->hdrgen) 628 630 { 629 631 if (haliassym) 630 632 { 631 633 haliassym->toCBuffer(buf, hgs); 632 634 buf->writeByte(' '); 633 635 buf->writestring(ident->toChars()); 634 636 } 635 637 else 636 638 htype->toCBuffer(buf, ident, hgs); 637 639 } 638 640 else trunk/src/declaration.c
r527 r607 577 577 578 578 const char *AliasDeclaration::kind() 579 579 { 580 580 return "alias"; 581 581 } 582 582 583 583 Type *AliasDeclaration::getType() 584 584 { 585 585 return type; 586 586 } 587 587 588 588 Dsymbol *AliasDeclaration::toAlias() 589 589 { 590 590 //printf("AliasDeclaration::toAlias('%s', this = %p, aliassym = %p, kind = '%s')\n", toChars(), this, aliassym, aliassym ? aliassym->kind() : ""); 591 591 assert(this != aliassym); 592 592 //static int count; if (++count == 10) *(char*)0=0; 593 593 if (inSemantic) 594 594 { error("recursive alias declaration"); 595 595 aliassym = new TypedefDeclaration(loc, ident, Type::terror, NULL); 596 596 } 597 else if (!aliassym && scope) 598 semantic(scope); 597 599 Dsymbol *s = aliassym ? aliassym->toAlias() : this; 598 600 return s; 599 601 } 600 602 601 603 void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) 602 604 { 603 605 buf->writestring("alias "); 604 606 #if 0 && _DH 605 607 if (hgs->hdrgen) 606 608 { 607 609 if (haliassym) 608 610 { 609 611 haliassym->toCBuffer(buf, hgs); 610 612 buf->writeByte(' '); 611 613 buf->writestring(ident->toChars()); 612 614 } 613 615 else 614 616 htype->toCBuffer(buf, ident, hgs); 615 617 } 616 618 else
