static map as a type function
Stefan Koch
uplink.coder at googlemail.com
Thu Sep 24 14:36:45 UTC 2020
On Thursday, 24 September 2020 at 14:25:37 UTC, Stefan Koch wrote:
>
> to make everything of typeid work at ctfe you would have to
> duplicate the whole typeinfo generation code. At least naively
> that's what you would have to do.
Let me show you the code that does only typeid.name
else if (ex.op == TOK.typeid_)
{
if (v.ident == Identifier.idPool("name"))
{
if (auto t = isType(ex.isTypeidExp().obj))
{
auto sym = t.toDsymbol(null);
if (auto ident = (sym ? sym.ident : null))
{
result = new StringExp(e.loc,
ident.toString());
result.expressionSemantic(null);
return ;
}
}
}
return notImplementedYet();
}
You would need at least 5-10 lines for every member of typeinfo.
More information about the Digitalmars-d
mailing list