Allow package protected members to be accessed by the declaring module even if

it isn't in a package.
This commit is contained in:
Christian Kamm
2009-05-21 18:08:31 +02:00
parent 2f150ddd62
commit d537ad0d48

View File

@@ -392,11 +392,12 @@ void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d)
#endif
if (!e)
{
if (d->prot() == PROTprivate && d->getModule() != sc->module ||
d->prot() == PROTpackage && !hasPackageAccess(sc, d))
if (d->getModule() != sc->module)
if (d->prot() == PROTprivate ||
d->prot() == PROTpackage && !hasPackageAccess(sc, d))
error(loc, "%s %s.%s is not accessible from %s",
d->kind(), d->getModule()->toChars(), d->toChars(), sc->module->toChars());
error(loc, "%s %s.%s is not accessible from %s",
d->kind(), d->getModule()->toChars(), d->toChars(), sc->module->toChars());
}
else if (e->type->ty == Tclass)
{ // Do access check