www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Instantiate the template class method

Hi! I engaged in addition to dmd with runtime reflection and
there was a problem:
If we have any template class, the real instantiated only those
methods that are used.
And to —Āonstruct the runtime reflection, I need to instantiate
the other methods. And here is a question: how to do it.
I write code like this:

static void WriteFunc(Dsymbol* root, FuncDeclaration* fd)
{
    if(root->inTemplateInstance() && fd->semanticRun < PASSobj)
    {
      assert(fd->inTemplateInstance());
      TemplateInstance* templ = fd->inTemplateInstance();
      fd->scope->parent = root;
      fd->semantic(fd->scope);
      fd->semantic2(fd->scope);
      fd->semantic3(fd->scope);
      assert(fd);
      assert(fd->scope);
      fd->toObjFile(0);
    }
}


In the trivial case, everything is fine.But if this function has
internal functions / delegates /foreach-loops I have the error.
Does anyone can tell me how to correctly instantiate the template
class method?
Mar 24 2012