本文整理汇总了C++中Dsymbol::isUnitTestDeclaration方法的典型用法代码示例。如果您正苦于以下问题:C++ Dsymbol::isUnitTestDeclaration方法的具体用法?C++ Dsymbol::isUnitTestDeclaration怎么用?C++ Dsymbol::isUnitTestDeclaration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dsymbol
的用法示例。
在下文中一共展示了Dsymbol::isUnitTestDeclaration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
int ScopeDsymbol::foreach(Scope *sc, Dsymbols *members, ScopeDsymbol::ForeachDg dg, void *ctx, size_t *pn)
{
assert(dg);
if (!members)
return 0;
size_t n = pn ? *pn : 0; // take over index
int result = 0;
for (size_t i = 0; i < members->dim; i++)
{ Dsymbol *s = (*members)[i];
if (AttribDeclaration *a = s->isAttribDeclaration())
result = foreach(sc, a->include(sc, NULL), dg, ctx, &n);
else if (TemplateMixin *tm = s->isTemplateMixin())
result = foreach(sc, tm->members, dg, ctx, &n);
else if (s->isTemplateInstance())
;
else if (s->isUnitTestDeclaration())
;
else
result = dg(ctx, n++, s);
if (result)
break;
}
if (pn)
*pn = n; // update index
return result;
}
示例2: collectUnitTests
/**
* Collects all unit test functions from the given array of symbols.
*
* This is a helper function used by the implementation of __traits(getUnitTests).
*
* Input:
* symbols array of symbols to collect the functions from
* uniqueUnitTests an associative array (should actually be a set) to
* keep track of already collected functions. We're
* using an AA here to avoid doing a linear search of unitTests
*
* Output:
* unitTests array of DsymbolExp's of the collected unit test functions
* uniqueUnitTests updated with symbols from unitTests[ ]
*/
static void collectUnitTests(Dsymbols *symbols, AA *uniqueUnitTests, Expressions *unitTests)
{
if (!symbols)
return;
for (size_t i = 0; i < symbols->dim; i++)
{
Dsymbol *symbol = (*symbols)[i];
UnitTestDeclaration *unitTest = symbol->isUnitTestDeclaration();
if (unitTest)
{
if (!_aaGetRvalue(uniqueUnitTests, unitTest))
{
FuncAliasDeclaration* alias = new FuncAliasDeclaration(unitTest, 0);
alias->protection = unitTest->protection;
Expression* e = new DsymbolExp(Loc(), alias);
unitTests->push(e);
bool* value = (bool*) _aaGet(&uniqueUnitTests, unitTest);
*value = true;
}
}
else
{
AttribDeclaration *attrDecl = symbol->isAttribDeclaration();
if (attrDecl)
{
Dsymbols *decl = attrDecl->include(NULL, NULL);
collectUnitTests(decl, uniqueUnitTests, unitTests);
}
}
}
}