Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 607

Show
Ignore:
Timestamp:
08/09/10 04:30:47 (14 years ago)
Author:
walter
Message:

bugzilla 4503 forward reference to aliased template instance

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/declaration.c

    r517 r607  
    599599{ 
    600600    //printf("AliasDeclaration::getType() %s\n", type->toChars()); 
    601601#if 0 
    602602    if (!type->deco && scope) 
    603603        semantic(scope); 
    604604    if (type && !type->deco) 
    605605        error("forward reference to alias %s\n", toChars()); 
    606606#endif 
    607607    return type; 
    608608} 
    609609 
    610610Dsymbol *AliasDeclaration::toAlias() 
    611611{ 
    612612    //printf("AliasDeclaration::toAlias('%s', this = %p, aliassym = %p, kind = '%s')\n", toChars(), this, aliassym, aliassym ? aliassym->kind() : ""); 
    613613    assert(this != aliassym); 
    614614    //static int count; if (++count == 75) exit(0); //*(char*)0=0; 
    615615    if (inSemantic) 
    616616    {   error("recursive alias declaration"); 
    617617        aliassym = new TypedefDeclaration(loc, ident, Type::terror, NULL); 
    618618    } 
     619    else if (!aliassym && scope) 
     620        semantic(scope); 
    619621    Dsymbol *s = aliassym ? aliassym->toAlias() : this; 
    620622    return s; 
    621623} 
    622624 
    623625void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) 
    624626{ 
    625627    buf->writestring("alias "); 
    626628#if 0 && _DH 
    627629    if (hgs->hdrgen) 
    628630    { 
    629631        if (haliassym) 
    630632        { 
    631633            haliassym->toCBuffer(buf, hgs); 
    632634            buf->writeByte(' '); 
    633635            buf->writestring(ident->toChars()); 
    634636        } 
    635637        else 
    636638            htype->toCBuffer(buf, ident, hgs); 
    637639    } 
    638640    else 
  • trunk/src/declaration.c

    r527 r607  
    577577 
    578578const char *AliasDeclaration::kind() 
    579579{ 
    580580    return "alias"; 
    581581} 
    582582 
    583583Type *AliasDeclaration::getType() 
    584584{ 
    585585    return type; 
    586586} 
    587587 
    588588Dsymbol *AliasDeclaration::toAlias() 
    589589{ 
    590590    //printf("AliasDeclaration::toAlias('%s', this = %p, aliassym = %p, kind = '%s')\n", toChars(), this, aliassym, aliassym ? aliassym->kind() : ""); 
    591591    assert(this != aliassym); 
    592592    //static int count; if (++count == 10) *(char*)0=0; 
    593593    if (inSemantic) 
    594594    {   error("recursive alias declaration"); 
    595595        aliassym = new TypedefDeclaration(loc, ident, Type::terror, NULL); 
    596596    } 
     597    else if (!aliassym && scope) 
     598        semantic(scope); 
    597599    Dsymbol *s = aliassym ? aliassym->toAlias() : this; 
    598600    return s; 
    599601} 
    600602 
    601603void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) 
    602604{ 
    603605    buf->writestring("alias "); 
    604606#if 0 && _DH 
    605607    if (hgs->hdrgen) 
    606608    { 
    607609        if (haliassym) 
    608610        { 
    609611            haliassym->toCBuffer(buf, hgs); 
    610612            buf->writeByte(' '); 
    611613            buf->writestring(ident->toChars()); 
    612614        } 
    613615        else 
    614616            htype->toCBuffer(buf, ident, hgs); 
    615617    } 
    616618    else