Merge dmd-1.073.

This commit is contained in:
kai
2012-02-23 20:41:22 +01:00
parent 53f9964b95
commit a23b837ebd
38 changed files with 2262 additions and 1340 deletions

View File

@@ -794,6 +794,7 @@ Dsymbol *ScopeDsymbol::search(Loc loc, Identifier *ident, int flags)
// Look in symbols declared in this module
Dsymbol *s = symtab ? symtab->lookup(ident) : NULL;
//printf("\ts = %p, imports = %p, %d\n", s, imports, imports ? imports->dim : 0);
// hide the aliases generated by selective or renamed private imports
if (s && flags & 1)
@@ -811,7 +812,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
@@ -821,7 +822,7 @@ Dsymbol *ScopeDsymbol::search(Loc loc, Identifier *ident, int flags)
//printf("\tscanning import '%s', prots = %d, isModule = %p, isImport = %p\n", ss->toChars(), prots[i], ss->isModule(), ss->isImport());
/* Don't find private members if ss is a module
*/
s2 = ss->search(loc, ident, ss->isModule() ? 1 : 0);
s2 = ss->search(loc, ident, ss->isImport() ? 1 : 0);
if (!s)
s = s2;
else if (s2 && s != s2)
@@ -850,7 +851,7 @@ Dsymbol *ScopeDsymbol::search(Loc loc, Identifier *ident, int flags)
)
)
{
ss->multiplyDefined(loc, s, s2);
ScopeDsymbol::multiplyDefined(loc, s, s2);
break;
}
}
@@ -859,14 +860,15 @@ 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);
@@ -874,11 +876,11 @@ void ScopeDsymbol::importScope(ScopeDsymbol *s, enum PROT protection)
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])
@@ -995,8 +997,7 @@ static int dimDg(void *ctx, size_t n, Dsymbol *)
size_t ScopeDsymbol::dim(Dsymbols *members)
{
size_t n = 0;
if (members)
foreach(members, &dimDg, &n);
foreach(members, &dimDg, &n);
return n;
}
#endif
@@ -1046,7 +1047,9 @@ Dsymbol *ScopeDsymbol::getNth(Dsymbols *members, size_t nth, size_t *pn)
#if DMDV2
int ScopeDsymbol::foreach(Dsymbols *members, ScopeDsymbol::ForeachDg dg, void *ctx, size_t *pn)
{
assert(members);
assert(dg);
if (!members)
return 0;
size_t n = pn ? *pn : 0; // take over index
int result = 0;