Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 626:e83ba4ae4878

Show
Ignore:
Timestamp:
10/01/08 13:16:10 (2 months ago)
Author:
Christian Kamm <kamm incasoftware de>
branch:
default
Message:

Fix import visibility bugs 313 and 314.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dmd/dsymbol.c

    r443 r626  
    647647    // Look in symbols declared in this module 
    648648    Dsymbol *s = symtab ? symtab->lookup(ident) : NULL; 
     649 
     650    // hide private nonlocal symbols 
     651    if (flags & 1 && s && s->prot() == PROTprivate) 
     652    s = NULL; 
     653 
    649654    if (s) 
    650655    { 
  • dmd/import.c

    r336 r626  
    3434    this->aliasId = aliasId; 
    3535    this->isstatic = isstatic; 
     36    protection = PROTundefined; 
    3637    pkg = NULL; 
    3738    mod = NULL; 
     
    6162} 
    6263 
     64enum PROT Import::prot() 
     65{ 
     66    return protection; 
     67} 
    6368 
    6469Dsymbol *Import::syntaxCopy(Dsymbol *s) 
     
    132137#endif 
    133138 
     139    /* Default to private importing 
     140     */ 
     141    protection = sc->protection; 
     142    if (!sc->explicitProtection) 
     143        protection = PROTprivate; 
     144 
    134145    if (!isstatic && !aliasId && !names.dim) 
    135146    { 
    136         /* Default to private importing 
    137          */ 
    138         enum PROT prot = sc->protection; 
    139         if (!sc->explicitProtection) 
    140         prot = PROTprivate; 
    141         sc->scopesym->importScope(mod, prot); 
     147        sc->scopesym->importScope(mod, protection); 
    142148    } 
    143149 
     
    150156    sc = sc->push(mod); 
    151157    for (size_t i = 0; i < aliasdecls.dim; i++) 
    152     {   Dsymbol *s = (Dsymbol *)aliasdecls.data[i]; 
     158    {   AliasDeclaration *ad = (AliasDeclaration *)aliasdecls.data[i]; 
    153159 
    154160        //printf("\tImport alias semantic('%s')\n", s->toChars()); 
     
    156162        error("%s not found", ((Identifier *)names.data[i])->toChars()); 
    157163 
    158         s->semantic(sc); 
     164        ad->semantic(sc); 
     165        ad->protection = protection; 
    159166    } 
    160167    sc = sc->pop(); 
  • dmd/import.h

    r336 r626  
    3535    Identifier *aliasId; 
    3636    int isstatic;       // !=0 if static import 
     37    enum PROT protection; 
    3738 
    3839    // Pairs of alias=name to bind into current namespace 
     
    5051 
    5152    const char *kind(); 
     53    enum PROT prot(); 
    5254    Dsymbol *syntaxCopy(Dsymbol *s);    // copy only syntax trees 
    5355    void load(Scope *sc); 
  • gen/toobj.cpp

    r622 r626  
    6565    LOG_SCOPE; 
    6666 
    67     printf("codegen: %s\n", srcfile->toChars()); 
     67//    printf("codegen: %s\n", srcfile->toChars()); 
    6868 
    6969    // start by deleting the old object file 
Copyright © 2008, LDC Development Team.