本文整理汇总了C++中Dsymbol::isScopeDsymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ Dsymbol::isScopeDsymbol方法的具体用法?C++ Dsymbol::isScopeDsymbol怎么用?C++ Dsymbol::isScopeDsymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dsymbol
的用法示例。
在下文中一共展示了Dsymbol::isScopeDsymbol方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ErrorExp
//.........这里部分代码省略.........
e->error("first argument is not a function");
goto Lfalse;
}
Expressions *mods = new Expressions();
PushAttributes pa;
pa.mods = mods;
tf->modifiersApply(&pa, &PushAttributes::fp);
tf->attributesApply(&pa, &PushAttributes::fp, TRUSTformatSystem);
TupleExp *tup = new TupleExp(e->loc, mods);
return tup->semantic(sc);
}
else if (e->ident == Id::allMembers || e->ident == Id::derivedMembers)
{
if (dim != 1)
goto Ldimerror;
RootObject *o = (*e->args)[0];
Dsymbol *s = getDsymbol(o);
ScopeDsymbol *sds;
if (!s)
{
e->error("argument has no members");
goto Lfalse;
}
Import *import;
if ((import = s->isImport()) != NULL)
{
// Bugzilla 9692
sds = import->mod;
}
else if ((sds = s->isScopeDsymbol()) == NULL)
{
e->error("%s %s has no members", s->kind(), s->toChars());
goto Lfalse;
}
// use a struct as local function
struct PushIdentsDg
{
static int dg(void *ctx, size_t n, Dsymbol *sm)
{
if (!sm)
return 1;
//printf("\t[%i] %s %s\n", i, sm->kind(), sm->toChars());
if (sm->ident)
{
if (sm->ident != Id::ctor &&
sm->ident != Id::dtor &&
sm->ident != Id::_postblit &&
memcmp(sm->ident->string, "__", 2) == 0)
{
return 0;
}
//printf("\t%s\n", sm->ident->toChars());
Identifiers *idents = (Identifiers *)ctx;
/* Skip if already present in idents[]
*/
for (size_t j = 0; j < idents->dim; j++)
{ Identifier *id = (*idents)[j];
if (id == sm->ident)
return 0;
示例2: if
//.........这里部分代码省略.........
TupleExp *tup = new TupleExp(loc, exps);
return tup->semantic(sc);
}
else
assert(0);
}
else if (ident == Id::classInstanceSize)
{
if (dim != 1)
goto Ldimerror;
Object *o = (Object *)args->data[0];
Dsymbol *s = getDsymbol(o);
ClassDeclaration *cd;
if (!s || (cd = s->isClassDeclaration()) == NULL)
{
// error("first argument is not a class");
goto Lfalse;
}
return new IntegerExp(loc, cd->structsize, Type::tsize_t);
}
else if (ident == Id::allMembers || ident == Id::derivedMembers)
{
if (dim != 1)
goto Ldimerror;
Object *o = (Object *)args->data[0];
Dsymbol *s = getDsymbol(o);
ScopeDsymbol *sd;
if (!s)
{
// error("argument has no members");
goto Lfalse;
}
if ((sd = s->isScopeDsymbol()) == NULL)
{
// error("%s %s has no members", s->kind(), s->toChars());
goto Lfalse;
}
Expressions *exps = new Expressions;
while (1)
{ size_t dim = ScopeDsymbol::dim(sd->members);
for (size_t i = 0; i < dim; i++)
{
Dsymbol *sm = ScopeDsymbol::getNth(sd->members, i);
//printf("\t[%i] %s %s\n", i, sm->kind(), sm->toChars());
if (sm->ident)
{
//printf("\t%s\n", sm->ident->toChars());
char *str = sm->ident->toChars();
/* Skip if already present in exps[]
*/
for (size_t j = 0; j < exps->dim; j++)
{ StringExp *se2 = (StringExp *)exps->data[j];
if (strcmp(str, (char *)se2->string) == 0)
goto Lnext;
}
StringExp *se = new StringExp(loc, str);
exps->push(se);
}
Lnext:
;
}
ClassDeclaration *cd = sd->isClassDeclaration();
if (cd && cd->baseClass && ident == Id::allMembers)