std.reflection prototype

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 5 10:49:39 PDT 2015


> I don't think so. I looked into it, and it looks to be pretty 
> low hanging and easy to do.
>
> I'm just not setup *grumbles*.

I'm trying to get it figured out right now.

It looks like this will load all the static data for me:
https://github.com/D-Programming-Language/druntime/blob/master/src/rt/sections_win32.d#L53

I'm guessing the TypeInfo will be part of the regular data
segment. I'm a little confused why the ModuleInfo has it's own
special segment.. Would that have to be done for all the
MemberInfo too? Anyways, as far as I can tell, druntime would not
have to be altered to implement offTi.

Looking at the compiler now, I'm trying to figure out where the
TypeInfo would be outputted.

It seems like this is it:
https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L1013

I'm pretty sure this function here is converting the typeinfo to
a linked list of data that gets outputted to the object file:

[code]
TypeInfo_toDt(&s->Sdt, tid);
[/code]
https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L1027

But, inside that call, I find this:

[code]
TypeInfoDtVisitor v(pdt);
d->accept(&v);
[/code]
https://github.com/D-Programming-Language/dmd/blob/master/src/typinf.c#L602

which finally leads me to...

void TypeInfoDtVisitor::visit(TypeInfoClassDeclaration *d)
{
      //printf("TypeInfoClassDeclaration::toDt() %s\n",
tinfo->toChars());
      assert(0);
}

which is not helpful.

Anyways, I'll keep looking, but help is welcome :)


More information about the Digitalmars-d mailing list