Cast to subclass in the dmd compiler
unDEFER via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 25 13:36:53 PDT 2017
Hello!
I'm hacking dmd compiler and trying to look on members array just
after parse module.
for(uint i = 0; i < members.dim; i++)
{
Dsymbol m = (*members)[i];
// It is good, but further:
Import imp = cast(Import) m;
if (imp !is null)
{
printf("++++ import %s.%s\n", imp.packages.toChars(),
imp.id.toChars());
}
// ...
}
For really imports casting doing well. But for not imports it
again casts, imp not is null and the compiler crashes.
What I'm doing wrong?
More information about the Digitalmars-d-learn
mailing list