www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - allMembers trait does not work correctly for packages during recursion

I'm trying to create a template class that can be parameterized 
with a module and will be able to serialize and deserialize (and 
more) all types in that module and submodules that have a 
specific UDA or superclass.

My initial idea was to do a recursive search for types by 
starting from the module parameter and applying allMembers 
recursively to submodules and packages to find all types. There 
is a problem though:

meta/search.d (For searching the classes): 
https://pastebin.com/BHJwnFYB
meta/seq.d (For some AliasSeq operations): 
https://pastebin.com/frq9JLrM
net/test.d (For testing): https://pastebin.com/4XiUBZMb


Here the net.test imports meta.search. If I parameterize 
TransitiveSearchUDA with net.test, it finds struct X and calls 
TransitiveSearchUDA for the package meta, but the allMembers 
trait for that package comes up empty. It does however return the 
members of the meta package somewhat correctly (it does not 
return the search module, only the contents of the search module) 
if I directly call allMembers on it from net.test without 
TransitiveSearchUDA.

What is the problem here? Or is there a better way to perform my 
task?
Jun 08 2018