traits.d (dmd-2.094.1) | : | traits.d (dmd-2.094.2) | ||
---|---|---|---|---|
skipping to change at line 1816 | skipping to change at line 1816 | |||
if (!s) | if (!s) | |||
{ | { | |||
e.error("argument `%s` to __traits(getUnitTests) must be a module or aggregate", | e.error("argument `%s` to __traits(getUnitTests) must be a module or aggregate", | |||
o.toChars()); | o.toChars()); | |||
return ErrorExp.get(); | return ErrorExp.get(); | |||
} | } | |||
if (auto imp = s.isImport()) // https://issues.dlang.org/show_bug.cgi?id =10990 | if (auto imp = s.isImport()) // https://issues.dlang.org/show_bug.cgi?id =10990 | |||
s = imp.mod; | s = imp.mod; | |||
auto sds = s.isScopeDsymbol(); | auto sds = s.isScopeDsymbol(); | |||
if (!sds) | if (!sds || sds.isTemplateDeclaration()) | |||
{ | { | |||
e.error("argument `%s` to __traits(getUnitTests) must be a module or aggregate, not a %s", | e.error("argument `%s` to __traits(getUnitTests) must be a module or aggregate, not a %s", | |||
s.toChars(), s.kind()); | s.toChars(), s.kind()); | |||
return ErrorExp.get(); | return ErrorExp.get(); | |||
} | } | |||
auto exps = new Expressions(); | auto exps = new Expressions(); | |||
if (global.params.useUnitTests) | if (global.params.useUnitTests) | |||
{ | { | |||
bool[void*] uniqueUnitTests; | bool[void*] uniqueUnitTests; | |||
void symbolDg(Dsymbol s) | void symbolDg(Dsymbol s) | |||
{ | { | |||
if (auto ad = s.isAttribDeclaration()) | if (auto ad = s.isAttribDeclaration()) | |||
{ | { | |||
ad.include(null).foreachDsymbol(&symbolDg); | ad.include(null).foreachDsymbol(&symbolDg); | |||
} | } | |||
else if (auto tm = s.isTemplateMixin()) | ||||
{ | ||||
tm.members.foreachDsymbol(&symbolDg); | ||||
} | ||||
else if (auto ud = s.isUnitTestDeclaration()) | else if (auto ud = s.isUnitTestDeclaration()) | |||
{ | { | |||
if (cast(void*)ud in uniqueUnitTests) | if (cast(void*)ud in uniqueUnitTests) | |||
return; | return; | |||
uniqueUnitTests[cast(void*)ud] = true; | uniqueUnitTests[cast(void*)ud] = true; | |||
auto ad = new FuncAliasDeclaration(ud.ident, ud, false); | auto ad = new FuncAliasDeclaration(ud.ident, ud, false); | |||
ad.protection = ud.protection; | ad.protection = ud.protection; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added |