[dmd-internals] How not to report unused identifiers
cy via dmd-internals
dmd-internals at puremagic.com
Tue Mar 29 14:11:09 PDT 2016
Well, Module in dmodule.d has a list called "members" returned
from parsing the code, each item a symbol that's supposedly a
member of that module. But, the list also includes template
specializations and package names, which are apparantly never
searched for?
In dmd, I made a bool[const(char)*] searched array in the Module
class, and added to that a symbol's "toChars" representation
every time it was searched for in that module. Then, in the third
pass (was that a mistake?) I compared every item in
Module.members to see if its toChars representation was in that
array. If not, it warns about an unused identifier.
So, it searched for like 5 symbols, and there were 2000 symbols
give or take in the members array, resulting in a wall of text of
unused identifiers, that are actually used I'm sure, but I have
no idea how to determine that, if they're never looked up.
More information about the dmd-internals
mailing list