本文整理汇总了C++中EnumMember::semantic方法的典型用法代码示例。如果您正苦于以下问题:C++ EnumMember::semantic方法的具体用法?C++ EnumMember::semantic怎么用?C++ EnumMember::semantic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnumMember
的用法示例。
在下文中一共展示了EnumMember::semantic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: semantic
void EnumDeclaration::semantic(Scope *sc)
{
//printf("EnumDeclaration::semantic(sd = %p, '%s') %s\n", sc->scopesym, sc->scopesym->toChars(), toChars());
//printf("EnumDeclaration::semantic() %p %s\n", this, toChars());
if (semanticRun >= PASSsemanticdone)
return; // semantic() already completed
if (semanticRun == PASSsemantic)
{
assert(memtype);
::error(loc, "circular reference to enum base type %s", memtype->toChars());
errors = true;
semanticRun = PASSsemanticdone;
return;
}
unsigned dprogress_save = Module::dprogress;
Scope *scx = NULL;
if (scope)
{
sc = scope;
scx = scope; // save so we don't make redundant copies
scope = NULL;
}
parent = sc->parent;
type = type->semantic(loc, sc);
protection = sc->protection;
if (sc->stc & STCdeprecated)
isdeprecated = true;
userAttribDecl = sc->userAttribDecl;
semanticRun = PASSsemantic;
if (!members && !memtype) // enum ident;
{
semanticRun = PASSsemanticdone;
return;
}
if (!symtab)
symtab = new DsymbolTable();
/* The separate, and distinct, cases are:
* 1. enum { ... }
* 2. enum : memtype { ... }
* 3. enum ident { ... }
* 4. enum ident : memtype { ... }
* 5. enum ident : memtype;
* 6. enum ident;
*/
if (memtype)
{
memtype = memtype->semantic(loc, sc);
/* Check to see if memtype is forward referenced
*/
if (memtype->ty == Tenum)
{
EnumDeclaration *sym = (EnumDeclaration *)memtype->toDsymbol(sc);
if (!sym->memtype || !sym->members || !sym->symtab || sym->scope)
{
// memtype is forward referenced, so try again later
scope = scx ? scx : sc->copy();
scope->setNoFree();
scope->module->addDeferredSemantic(this);
Module::dprogress = dprogress_save;
//printf("\tdeferring %s\n", toChars());
semanticRun = PASSinit;
return;
}
}
if (memtype->ty == Tvoid)
{
error("base type must not be void");
memtype = Type::terror;
}
if (memtype->ty == Terror)
{
errors = true;
if (members)
{
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
s->errors = true; // poison all the members
}
}
semanticRun = PASSsemanticdone;
return;
}
}
semanticRun = PASSsemanticdone;
if (!members) // enum ident : memtype;
return;
if (members->dim == 0)
//.........这里部分代码省略.........