Skip to content

Commit

Permalink
partial integration of pull 190
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Dec 31, 2011
1 parent 9a66fc1 commit 05a314a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/dsymbol.c
Expand Up @@ -759,7 +759,7 @@ Dsymbol *ScopeDsymbol::search(Loc loc, Identifier *ident, int flags)
{
// Look in imported modules
for (size_t i = 0; i < imports->dim; i++)
{ ScopeDsymbol *ss = (*imports)[i];
{ Dsymbol *ss = (*imports)[i];
Dsymbol *s2;

// If private import, don't search it
Expand Down Expand Up @@ -798,7 +798,7 @@ Dsymbol *ScopeDsymbol::search(Loc loc, Identifier *ident, int flags)
)
)
{
ss->multiplyDefined(loc, s, s2);
ScopeDsymbol::multiplyDefined(loc, s, s2);
break;
}
}
Expand All @@ -807,26 +807,27 @@ Dsymbol *ScopeDsymbol::search(Loc loc, Identifier *ident, int flags)
if (s)
{
Declaration *d = s->isDeclaration();
if (d && d->protection == PROTprivate && !d->parent->isTemplateMixin())
if (d && d->protection == PROTprivate &&
!d->parent->isTemplateMixin())
error(loc, "%s is private", d->toPrettyChars());
}
}
return s;
}

void ScopeDsymbol::importScope(ScopeDsymbol *s, enum PROT protection)
void ScopeDsymbol::importScope(Dsymbol *s, enum PROT protection)
{
//printf("%s->ScopeDsymbol::importScope(%s, %d)\n", toChars(), s->toChars(), protection);

// No circular or redundant import's
if (s != this)
{
if (!imports)
imports = new ScopeDsymbols();
imports = new Dsymbols();
else
{
for (size_t i = 0; i < imports->dim; i++)
{ ScopeDsymbol *ss = (*imports)[i];
{ Dsymbol *ss = (*imports)[i];
if (ss == s) // if already imported
{
if (protection > prots[i])
Expand Down
4 changes: 2 additions & 2 deletions src/dsymbol.h
Expand Up @@ -248,14 +248,14 @@ struct ScopeDsymbol : Dsymbol
Dsymbols *members; // all Dsymbol's in this scope
DsymbolTable *symtab; // members[] sorted into table

ScopeDsymbols *imports; // imported ScopeDsymbol's
Dsymbols *imports; // imported Dsymbol's
unsigned char *prots; // array of PROT, one for each import

ScopeDsymbol();
ScopeDsymbol(Identifier *id);
Dsymbol *syntaxCopy(Dsymbol *s);
Dsymbol *search(Loc loc, Identifier *ident, int flags);
void importScope(ScopeDsymbol *s, enum PROT protection);
void importScope(Dsymbol *s, enum PROT protection);
int isforwardRef();
void defineRef(Dsymbol *s);
static void multiplyDefined(Loc loc, Dsymbol *s1, Dsymbol *s2);
Expand Down

0 comments on commit 05a314a

Please sign in to comment.