TREE_THIS_VOLATILE (decl->csym) = 1;
/* Protection attributes are used by the debugger. */
- if (decl->protection.kind == PROTprivate)
+ if (decl->protection.kind == Prot::private_)
TREE_PRIVATE (decl->csym) = 1;
- else if (decl->protection.kind == PROTprotected)
+ else if (decl->protection.kind == Prot::protected_)
TREE_PROTECTED (decl->csym) = 1;
/* Likewise, so could the deprecated attribute. */
-108ca1bcde2096a2c6173c567a204d749538dd74
+73d8e2fecb9e73422464b4cbf71f2b2967c9a75d
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
*/
Prot getAccess(AggregateDeclaration *ad, Dsymbol *smember)
{
- Prot access_ret = Prot(PROTnone);
+ Prot access_ret = Prot(Prot::none);
assert(ad->isStructDeclaration() || ad->isClassDeclaration());
if (smember->toParent() == ad)
Prot access = getAccess(b->sym, smember);
switch (access.kind)
{
- case PROTnone:
+ case Prot::none:
break;
- case PROTprivate:
- access_ret = Prot(PROTnone); // private members of base class not accessible
+ case Prot::private_:
+ access_ret = Prot(Prot::none); // private members of base class not accessible
break;
- case PROTpackage:
- case PROTprotected:
- case PROTpublic:
- case PROTexport:
+ case Prot::package_:
+ case Prot::protected_:
+ case Prot::public_:
+ case Prot::export_:
// If access is to be tightened
- if (PROTpublic < access.kind)
- access = Prot(PROTpublic);
+ if (Prot::public_ < access.kind)
+ access = Prot(Prot::public_);
// Pick path with loosest access
if (access_ret.isMoreRestrictiveThan(access))
{
BaseClass *b = (*cdthis->baseclasses)[i];
Prot access = getAccess(b->sym, smember);
- if (access.kind >= PROTprotected ||
+ if (access.kind >= Prot::protected_ ||
isAccessible(smember, sfunc, b->sym, cdscope))
{
return true;
if (smemberparent == ad)
{
access = smember->prot();
- result = access.kind >= PROTpublic ||
+ result = access.kind >= Prot::public_ ||
hasPrivateAccess(ad, f) ||
isFriendOf(ad, cdscope) ||
- (access.kind == PROTpackage && hasPackageAccess(sc, smember)) ||
+ (access.kind == Prot::package_ && hasPackageAccess(sc, smember)) ||
ad->getAccessModule() == sc->_module;
}
- else if ((access = getAccess(ad, smember)).kind >= PROTpublic)
+ else if ((access = getAccess(ad, smember)).kind >= Prot::public_)
{
result = true;
}
- else if (access.kind == PROTpackage && hasPackageAccess(sc, ad))
+ else if (access.kind == Prot::package_ && hasPackageAccess(sc, ad))
{
result = true;
}
}
if (!e)
{
- if ((d->prot().kind == PROTprivate && d->getAccessModule() != sc->_module) ||
- (d->prot().kind == PROTpackage && !hasPackageAccess(sc, d)))
+ if ((d->prot().kind == Prot::private_ && d->getAccessModule() != sc->_module) ||
+ (d->prot().kind == Prot::package_ && !hasPackageAccess(sc, d)))
{
error(loc, "%s %s is not accessible from module %s",
d->kind(), d->toPrettyChars(), sc->_module->toChars());
return false;
for (; sc; sc = sc->enclosing)
{
- if (sc->scopesym && sc->scopesym->isPackageAccessible(p, Prot(PROTprivate)))
+ if (sc->scopesym && sc->scopesym->isPackageAccessible(p, Prot(Prot::private_)))
return false;
}
const char *name = p->toPrettyChars();
switch (s->prot().kind)
{
- case PROTundefined:
+ case Prot::undefined:
return true;
- case PROTnone:
+ case Prot::none:
return false; // no access
- case PROTprivate:
+ case Prot::private_:
return s->getAccessModule() == mod;
- case PROTpackage:
+ case Prot::package_:
return s->getAccessModule() == mod || hasPackageAccess(mod, s);
- case PROTprotected:
+ case Prot::protected_:
return s->getAccessModule() == mod;
- case PROTpublic:
- case PROTexport:
+ case Prot::public_:
+ case Prot::export_:
return true;
default:
assert(0);
switch (s->prot().kind)
{
- case PROTundefined:
+ case Prot::undefined:
return true;
- case PROTnone:
+ case Prot::none:
return false; // no access
- case PROTprivate:
+ case Prot::private_:
return sc->_module == s->getAccessModule();
- case PROTpackage:
+ case Prot::package_:
return sc->_module == s->getAccessModule() || hasPackageAccess(sc->_module, s);
- case PROTprotected:
+ case Prot::protected_:
return hasProtectedAccess(sc, s);
- case PROTpublic:
- case PROTexport:
+ case Prot::public_:
+ case Prot::export_:
return true;
default:
assert(0);
//printf("fd: %s %s\n", ident->toChars(), ftype->toChars());
FuncDeclaration *fd = new FuncDeclaration(Loc(), Loc(), ident, STCundefined, ftype);
fd->fbody = fbody;
- fd->protection = Prot(PROTpublic);
+ fd->protection = Prot(Prot::public_);
fd->linkage = LINKc;
fd->isArrayOp = 1;
: AttribDeclaration(decl)
{
this->loc = loc;
- this->protection.kind = PROTpackage;
+ this->protection.kind = Prot::package_;
this->protection.pkg = NULL;
this->pkg_identifiers = pkg_identifiers;
}
Dsymbol *ProtDeclaration::syntaxCopy(Dsymbol *s)
{
assert(!s);
- if (protection.kind == PROTpackage)
+ if (protection.kind == Prot::package_)
return new ProtDeclaration(this->loc, pkg_identifiers, Dsymbol::arraySyntaxCopy(decl));
else
return new ProtDeclaration(this->loc, protection, Dsymbol::arraySyntaxCopy(decl));
pkg_identifiers = NULL;
}
- if (protection.kind == PROTpackage && protection.pkg && sc->_module)
+ if (protection.kind == Prot::package_ && protection.pkg && sc->_module)
{
Module *m = sc->_module;
Package* pkg = m->parent ? m->parent->isPackage() : NULL;
const char *ProtDeclaration::toPrettyChars(bool)
{
- assert(protection.kind > PROTundefined);
+ assert(protection.kind > Prot::undefined);
OutBuffer buf;
buf.writeByte('\'');
{
VarDeclaration *vd = fields[i];
if (!vd->isThisDeclaration() &&
- !vd->prot().isMoreRestrictiveThan(Prot(PROTpublic)))
+ !vd->prot().isMoreRestrictiveThan(Prot(Prot::public_)))
{
vd->error("Field members of a synchronized class cannot be %s",
protectionToChars(vd->prot().kind));
continue;
else if (s == this) // happens if s is nested in this and derives from this
s = NULL;
- else if (!(flags & IgnoreSymbolVisibility) && !(s->prot().kind == PROTprotected) && !symbolIsVisible(this, s))
+ else if (!(flags & IgnoreSymbolVisibility) && !(s->prot().kind == Prot::protected_) && !symbolIsVisible(this, s))
s = NULL;
else
break;
type = NULL;
originalType = NULL;
storage_class = STCundefined;
- protection = Prot(PROTundefined);
+ protection = Prot(Prot::undefined);
linkage = LINKdefault;
inuse = 0;
mangleOverride = NULL;
bool VarDeclaration::isExport() const
{
- return protection.kind == PROTexport;
+ return protection.kind == Prot::export_;
}
bool VarDeclaration::isImportedSymbol() const
{
- if (protection.kind == PROTexport && !_init &&
+ if (protection.kind == Prot::export_ && !_init &&
(storage_class & STCstatic || parent->isModule()))
return true;
return false;
{
this->tinfo = tinfo;
storage_class = STCstatic | STCgshared;
- protection = Prot(PROTpublic);
+ protection = Prot(Prot::public_);
linkage = LINKc;
alignment = target.ptrsize;
}
defaultval = NULL;
sinit = NULL;
isdeprecated = false;
- protection = Prot(PROTundefined);
+ protection = Prot(Prot::undefined);
parent = NULL;
added = false;
inuse = 0;
semanticRun = PASSsemantic;
- protection = ed->isAnonymous() ? ed->protection : Prot(PROTpublic);
+ protection = ed->isAnonymous() ? ed->protection : Prot(Prot::public_);
linkage = LINKd;
storage_class = STCmanifest;
userAttribDecl = ed->isAnonymous() ? ed->userAttribDecl : NULL;
this->id = id;
this->aliasId = aliasId;
this->isstatic = isstatic;
- this->protection = Prot(PROTprivate); // default to private
+ this->protection = Prot(Prot::private_); // default to private
this->pkg = NULL;
this->mod = NULL;
if (insearch) // don't follow import cycles
return false;
if (flags & IgnorePrivateImports)
- protection = Prot(PROTpublic); // only consider public imports
+ protection = Prot(Prot::public_); // only consider public imports
insearch = true;
bool r = ScopeDsymbol::isPackageAccessible(p, protection);
insearch = false;
void emitProtection(OutBuffer *buf, Prot prot)
{
- if (prot.kind != PROTundefined && prot.kind != PROTpublic)
+ if (prot.kind != Prot::undefined && prot.kind != Prot::public_)
{
protectionToBuffer(buf, prot);
buf->writeByte(' ');
return;
if (!d->type && !d->isCtorDeclaration() && !d->isAliasDeclaration())
return;
- if (d->protection.kind == PROTprivate || sc->protection.kind == PROTprivate)
+ if (d->protection.kind == Prot::private_ || sc->protection.kind == Prot::private_)
return;
}
if (!com)
}
else
{
- if (ad->prot().kind == PROTprivate || sc->protection.kind == PROTprivate)
+ if (ad->prot().kind == Prot::private_ || sc->protection.kind == Prot::private_)
return;
if (!ad->comment)
return;
void visit(TemplateDeclaration *td)
{
//printf("TemplateDeclaration::emitComment() '%s', kind = %s\n", td->toChars(), td->kind());
- if (td->prot().kind == PROTprivate || sc->protection.kind == PROTprivate)
+ if (td->prot().kind == Prot::private_ || sc->protection.kind == Prot::private_)
return;
if (!td->comment)
return;
void visit(EnumDeclaration *ed)
{
- if (ed->prot().kind == PROTprivate || sc->protection.kind == PROTprivate)
+ if (ed->prot().kind == Prot::private_ || sc->protection.kind == Prot::private_)
return;
if (ed->isAnonymous() && ed->members)
{
void visit(EnumMember *em)
{
//printf("EnumMember::emitComment(%p '%s'), comment = '%s'\n", em, em->toChars(), em->comment);
- if (em->prot().kind == PROTprivate || sc->protection.kind == PROTprivate)
+ if (em->prot().kind == Prot::private_ || sc->protection.kind == Prot::private_)
return;
if (!em->comment)
return;
buf->writestring(": ");
any = 1;
}
- emitProtection(buf, Prot(PROTpublic));
+ emitProtection(buf, Prot(Prot::public_));
if (bc->sym)
{
buf->printf("$(DDOC_PSUPER_SYMBOL %s)", bc->sym->toPrettyChars());
for (UnitTestDeclaration *utd = s->ddocUnittest; utd; utd = utd->ddocUnittest)
{
- if (utd->protection.kind == PROTprivate || !utd->comment || !utd->fbody)
+ if (utd->protection.kind == Prot::private_ || !utd->comment || !utd->fbody)
continue;
// Strip whitespaces to avoid showing empty summary
this->linkage = LINKd;
this->cppmangle = CPPMANGLEdefault;
this->inlining = PINLINEdefault;
- this->protection = Prot(PROTpublic);
+ this->protection = Prot(Prot::public_);
this->explicitProtection = 0;
this->stc = 0;
this->depdecl = NULL;
sc->aligndecl = NULL;
sc->linkage = LINKd;
sc->inlining = PINLINEdefault;
- sc->protection = Prot(PROTpublic);
+ sc->protection = Prot(Prot::public_);
sc->_module = _module;
if (scopesym != s->parent)
{
(*cost)++; // got to the symbol through an import
- if (s->prot().kind == PROTprivate)
+ if (s->prot().kind == Prot::private_)
return NULL;
}
}
this->loc = loc;
storage_class = 0;
- protection = Prot(PROTpublic);
+ protection = Prot(Prot::public_);
type = NULL;
structsize = 0; // size of struct
alignsize = 0; // size of struct for alignment purposes
sc2->parent = this;
if (isUnionDeclaration())
sc2->inunion = 1;
- sc2->protection = Prot(PROTpublic);
+ sc2->protection = Prot(Prot::public_);
sc2->explicitProtection = 0;
sc2->aligndecl = NULL;
sc2->userAttribDecl = NULL;
bool AggregateDeclaration::isExport() const
{
- return protection.kind == PROTexport;
+ return protection.kind == Prot::export_;
}
/***************************************
// Emulate vthis->semantic()
vthis->storage_class |= STCfield;
vthis->parent = this;
- vthis->protection = Prot(PROTpublic);
+ vthis->protection = Prot(Prot::public_);
vthis->alignment = t->alignment();
vthis->semanticRun = PASSsemanticdone;
Prot Dsymbol::prot()
{
- return Prot(PROTpublic);
+ return Prot(Prot::public_);
}
/*************************************
for (size_t i = 0; i < importedScopes->length; i++)
{
// If private import, don't search it
- if ((flags & IgnorePrivateImports) && prots[i] == PROTprivate)
+ if ((flags & IgnorePrivateImports) && prots[i] == Prot::private_)
continue;
int sflags = flags & (IgnoreErrors | IgnoreAmbiguous | IgnoreSymbolVisibility); // remember these in recursive searches
* the other.
*/
if (s->isDeprecated() ||
- (s->prot().isMoreRestrictiveThan(s2->prot()) && s2->prot().kind != PROTnone))
+ (s->prot().isMoreRestrictiveThan(s2->prot()) && s2->prot().kind != Prot::none))
s = s2;
}
else
}
// TODO: remove once private symbol visibility has been deprecated
- if (!(flags & IgnoreErrors) && s->prot().kind == PROTprivate &&
+ if (!(flags & IgnoreErrors) && s->prot().kind == Prot::private_ &&
!s->isOverloadable() && !s->parent->isTemplateMixin() && !s->parent->isNspace())
{
AliasDeclaration *ad;
{
if (s2->isDeprecated() ||
(s2->prot().isMoreRestrictiveThan(s->prot()) &&
- s->prot().kind != PROTnone))
+ s->prot().kind != Prot::none))
{
os->a[j] = s;
}
}
}
importedScopes->push(s);
- prots = (PROTKIND *)mem.xrealloc(prots, importedScopes->length * sizeof(prots[0]));
+ prots = (Prot::Kind *)mem.xrealloc(prots, importedScopes->length * sizeof(prots[0]));
prots[importedScopes->length - 1] = protection.kind;
}
}
void ScopeDsymbol::addAccessiblePackage(Package *p, Prot protection)
{
- BitArray *pary = protection.kind == PROTprivate ? &privateAccessiblePackages : &accessiblePackages;
+ BitArray *pary = protection.kind == Prot::private_ ? &privateAccessiblePackages : &accessiblePackages;
if (pary->len <= p->tag)
bitArrayLength(pary, p->tag + 1);
bitArraySet(pary, p->tag);
bool ScopeDsymbol::isPackageAccessible(Package *p, Prot protection, int)
{
if ((p->tag < accessiblePackages.len && bitArrayGet(&accessiblePackages, p->tag)) ||
- (protection.kind == PROTprivate && p->tag < privateAccessiblePackages.len && bitArrayGet(&privateAccessiblePackages, p->tag)))
+ (protection.kind == Prot::private_ && p->tag < privateAccessiblePackages.len && bitArrayGet(&privateAccessiblePackages, p->tag)))
return true;
if (importedScopes)
{
Prot::Prot()
{
- this->kind = PROTundefined;
+ this->kind = Prot::undefined;
this->pkg = NULL;
}
-Prot::Prot(PROTKIND kind)
+Prot::Prot(Prot::Kind kind)
{
this->kind = kind;
this->pkg = NULL;
{
if (this->kind == other.kind)
{
- if (this->kind == PROTpackage)
+ if (this->kind == Prot::package_)
return this->pkg == other.pkg;
return true;
}
if (this->kind != parent.kind)
return false;
- if (this->kind == PROTpackage)
+ if (this->kind == Prot::package_)
{
if (!this->pkg)
return true;
~Ungag() { global.gag = oldgag; }
};
-enum PROTKIND
-{
- PROTundefined,
- PROTnone, // no access
- PROTprivate,
- PROTpackage,
- PROTprotected,
- PROTpublic,
- PROTexport
-};
-
struct Prot
{
- PROTKIND kind;
+ enum Kind
+ {
+ undefined,
+ none, // no access
+ private_,
+ package_,
+ protected_,
+ public_,
+ export_
+ };
+ Kind kind;
Package *pkg;
Prot();
- Prot(PROTKIND kind);
+ Prot(Kind kind);
bool isMoreRestrictiveThan(const Prot other) const;
bool operator==(const Prot& other) const;
// in hdrgen.c
void protectionToBuffer(OutBuffer *buf, Prot prot);
-const char *protectionToChars(PROTKIND kind);
+const char *protectionToChars(Prot::Kind kind);
/* State of symbol in winding its way through the passes of the compiler
*/
private:
Dsymbols *importedScopes; // imported Dsymbol's
- PROTKIND *prots; // array of PROTKIND, one for each import
+ Prot::Kind *prots; // array of PROTKIND, one for each import
BitArray accessiblePackages, privateAccessiblePackages;
this->ismixin = ismixin;
this->isstatic = true;
this->previous = NULL;
- this->protection = Prot(PROTundefined);
+ this->protection = Prot(Prot::undefined);
this->instances = NULL;
// Compute in advance for Ddoc's use
// Declare each template parameter as an alias for the argument type
Scope *paramscope = scope->push();
paramscope->stc = 0;
- paramscope->protection = Prot(PROTpublic); // Bugzilla 14169: template parameters should be public
+ paramscope->protection = Prot(Prot::public_); // Bugzilla 14169: template parameters should be public
declareParameters(paramscope);
paramscope->pop();
ScopeDsymbol *sds = (ScopeDsymbol *)sce->scopesym;
if (sds)
{
- sds->importScope(this, Prot(PROTpublic));
+ sds->importScope(this, Prot(Prot::public_));
break;
}
}
sc = sc->push(); // just create new scope
sc->flags &= ~SCOPEctfe; // temporary stop CTFE
- sc->protection = Prot(PROTpublic); // Bugzilla 12506
+ sc->protection = Prot(Prot::public_); // Bugzilla 12506
if (!exp->type || exp->type == Type::tvoid)
{
const char *sfunc;
if (isStatic())
sfunc = "static";
- else if (protection.kind == PROTprivate || protection.kind == PROTpackage)
+ else if (protection.kind == Prot::private_ || protection.kind == Prot::package_)
sfunc = protectionToChars(protection.kind);
else
sfunc = "non-virtual";
if (isOverride() && !isVirtual())
{
- PROTKIND kind = prot().kind;
- if ((kind == PROTprivate || kind == PROTpackage) && isMember())
+ Prot::Kind kind = prot().kind;
+ if ((kind == Prot::private_ || kind == Prot::package_) && isMember())
error("%s method is not virtual and cannot override", protectionToChars(kind));
else
error("cannot override a non-virtual function");
if (f2)
{
f2 = f2->overloadExactMatch(type);
- if (f2 && f2->isFinalFunc() && f2->prot().kind != PROTprivate)
+ if (f2 && f2->isFinalFunc() && f2->prot().kind != Prot::private_)
error("cannot override final function %s", f2->toPrettyChars());
}
}
if (f2)
{
f2 = f2->overloadExactMatch(type);
- if (f2 && f2->isFinalFunc() && f2->prot().kind != PROTprivate)
+ if (f2 && f2->isFinalFunc() && f2->prot().kind != Prot::private_)
error("cannot override final function %s.%s", b->sym->toChars(), f2->toPrettyChars());
}
}
STCdeprecated | STCoverride |
STC_TYPECTOR | STCfinal | STCtls | STCgshared | STCref | STCreturn |
STCproperty | STCnothrow | STCpure | STCsafe | STCtrusted | STCsystem);
- sc2->protection = Prot(PROTpublic);
+ sc2->protection = Prot(Prot::public_);
sc2->explicitProtection = 0;
sc2->aligndecl = NULL;
if (this->ident != Id::require && this->ident != Id::ensure)
bool FuncDeclaration::isExport() const
{
- return protection.kind == PROTexport;
+ return protection.kind == Prot::export_;
}
bool FuncDeclaration::isImportedSymbol() const
{
//printf("isImportedSymbol()\n");
//printf("protection = %d\n", protection);
- return (protection.kind == PROTexport) && !fbody;
+ return (protection.kind == Prot::export_) && !fbody;
}
// Determine if function goes into virtual function pointer table
Dsymbol *p = toParent();
return isMember() &&
- !(isStatic() || protection.kind == PROTprivate || protection.kind == PROTpackage) &&
+ !(isStatic() || protection.kind == Prot::private_ || protection.kind == Prot::package_) &&
p->isClassDeclaration() &&
!(p->isInterfaceDeclaration() && isFinalFunc());
}
ClassDeclaration *cd = ad ? ad->isClassDeclaration() : NULL;
return (ad && !(cd && cd->isCPPclass()) &&
global.params.useInvariants == CHECKENABLEon &&
- (protection.kind == PROTprotected || protection.kind == PROTpublic || protection.kind == PROTexport) &&
+ (protection.kind == Prot::protected_ || protection.kind == Prot::public_ || protection.kind == Prot::export_) &&
!naked);
}
return (ad && !(cd && cd->isCPPclass()) &&
ad->inv &&
global.params.useInvariants == CHECKENABLEon &&
- (protection.kind == PROTprotected || protection.kind == PROTpublic || protection.kind == PROTexport) &&
+ (protection.kind == Prot::protected_ || protection.kind == Prot::public_ || protection.kind == Prot::export_) &&
!naked);
}
{
tf = new TypeFunction(ParameterList(fparams), treturn, LINKc, stc);
fd = new FuncDeclaration(Loc(), Loc(), id, STCstatic, tf);
- fd->protection = Prot(PROTpublic);
+ fd->protection = Prot(Prot::public_);
fd->linkage = LINKc;
st->insert(fd);
if (p)
buf->writestring(p);
- if (prot.kind == PROTpackage && prot.pkg)
+ if (prot.kind == Prot::package_ && prot.pkg)
{
buf->writeByte('(');
buf->writestring(prot.pkg->toPrettyChars(true));
}
}
-const char *protectionToChars(PROTKIND kind)
+const char *protectionToChars(Prot::Kind kind)
{
switch (kind)
{
- case PROTundefined: return NULL;
- case PROTnone: return "none";
- case PROTprivate: return "private";
- case PROTpackage: return "package";
- case PROTprotected: return "protected";
- case PROTpublic: return "public";
- case PROTexport: return "export";
+ case Prot::undefined: return NULL;
+ case Prot::none: return "none";
+ case Prot::private_: return "private";
+ case Prot::package_: return "package";
+ case Prot::protected_: return "protected";
+ case Prot::public_: return "public";
+ case Prot::export_: return "export";
default: assert(0);
}
return NULL; // never reached
property("kind", s->kind());
}
- if (s->prot().kind != PROTpublic) // TODO: How about package(names)?
+ if (s->prot().kind != Prot::public_) // TODO: How about package(names)?
property("protection", protectionToChars(s->prot().kind));
if (EnumMember *em = s->isEnumMember())
property("kind", s->kind());
property("comment", (const char *)s->comment);
property("line", "char", &s->loc);
- if (s->prot().kind != PROTpublic)
+ if (s->prot().kind != Prot::public_)
property("protection", protectionToChars(s->prot().kind));
if (s->aliasId)
property("alias", s->aliasId->toChars());
*/
Scope *argsc = sc->push();
argsc->stc = 0; // don't inherit storage class
- argsc->protection = Prot(PROTpublic);
+ argsc->protection = Prot(Prot::public_);
argsc->func = NULL;
size_t dim = tf->parameterList.length();
ScopeDsymbol *sds2 = sce->scopesym;
if (sds2)
{
- sds2->importScope(this, Prot(PROTpublic));
+ sds2->importScope(this, Prot(Prot::public_));
break;
}
}
: storageClass(STCundefined),
depmsg(NULL),
link(LINKdefault),
- protection(PROTundefined),
+ protection(Prot::undefined),
setAlignment(false),
ealign(NULL),
udas(NULL),
pAttrs = &attrs;
pAttrs->comment = token.blockComment;
}
- PROTKIND prot;
+ Prot::Kind prot;
StorageClass stc;
Condition *condition;
break;
}
- case TOKprivate: prot = PROTprivate; goto Lprot;
- case TOKpackage: prot = PROTpackage; goto Lprot;
- case TOKprotected: prot = PROTprotected; goto Lprot;
- case TOKpublic: prot = PROTpublic; goto Lprot;
- case TOKexport: prot = PROTexport; goto Lprot;
+ case TOKprivate: prot = Prot::private_; goto Lprot;
+ case TOKpackage: prot = Prot::package_; goto Lprot;
+ case TOKprotected: prot = Prot::protected_; goto Lprot;
+ case TOKpublic: prot = Prot::public_; goto Lprot;
+ case TOKexport: prot = Prot::export_; goto Lprot;
Lprot:
{
- if (pAttrs->protection.kind != PROTundefined)
+ if (pAttrs->protection.kind != Prot::undefined)
{
if (pAttrs->protection.kind != prot)
error("conflicting protection attribute '%s' and '%s'",
// optional qualified package identifier to bind
// protection to
Identifiers *pkg_prot_idents = NULL;
- if (pAttrs->protection.kind == PROTpackage && token.value == TOKlparen)
+ if (pAttrs->protection.kind == Prot::package_ && token.value == TOKlparen)
{
pkg_prot_idents = parseQualifiedIdentifier("protection package");
Loc attrloc = token.loc;
a = parseBlock(pLastDecl, pAttrs);
- if (pAttrs->protection.kind != PROTundefined)
+ if (pAttrs->protection.kind != Prot::undefined)
{
- if (pAttrs->protection.kind == PROTpackage && pkg_prot_idents)
+ if (pAttrs->protection.kind == Prot::package_ && pkg_prot_idents)
s = new ProtDeclaration(attrloc, pkg_prot_idents, a);
else
s = new ProtDeclaration(attrloc, pAttrs->protection, a);
- pAttrs->protection = Prot(PROTundefined);
+ pAttrs->protection = Prot(Prot::undefined);
}
break;
}
for (; 1; nextToken())
{
bool prot = false;
- Prot protection = Prot(PROTpublic);
+ Prot protection = Prot(Prot::public_);
switch (token.value)
{
case TOKprivate:
prot = true;
- protection = Prot(PROTprivate);
+ protection = Prot(Prot::private_);
nextToken();
break;
case TOKpackage:
prot = true;
- protection = Prot(PROTpackage);
+ protection = Prot(Prot::package_);
nextToken();
break;
case TOKprotected:
prot = true;
- protection = Prot(PROTprotected);
+ protection = Prot(Prot::protected_);
nextToken();
break;
case TOKpublic:
prot = true;
- protection = Prot(PROTpublic);
+ protection = Prot(Prot::public_);
nextToken();
break;
default: break;
Identifier::idPool (name));
fd->loc = Loc (mod->srcfile->toChars (), 1, 0);
fd->parent = mod;
- fd->protection.kind = PROTprivate;
+ fd->protection.kind = Prot::private_;
fd->semanticRun = PASSsemantic3done;
return fd;