Here’s version 0.1.0 of the creatively named cr-source-typer project:
It works on my machine, but buyer beware and all that :) If you try it and find issues, please let me know so I can improve it!
And another mini brain dump along the lines of the one that started this thread:
- Running the
semanticprocess has acleanupproperty; setting this totruewill cause it to expand the returned ASTNode to contain all required files and expanded macros. Setting it tofalsedoesn’t. - After
semantichas run, theprogramobject has atypesvariable that’s a hash of the type name =>Typeinstance representing that class / struct / whatever. - The
typeshash only contains the top level types - to get to ones within “namespaces” (or subclasses, etc.), a breadth-first-search expansion can be done, using each types’ owntypesvariable to get the subtypes under it. - Similarly, the previously described
defsanddef_instanceson theprogramobject only contain the top level methods and its typed definitions. Use theType#defsandType#def_instancesto get the methods for individual types (keeping in mind not everyTypeactually has or supports methods) - Static / class methods don’t exist on the
Typedirectly (which contains instance level variables and methods), but instead on the*MetaclassType, which is a type specific to capturing class level information. Usetype#metaclassto get a metaclass of a given type. This is the difference betweenStringandString.class *MetaclassTypealso use thedefsanddef_instancesto store the class level methods (likenewandallocate, by default).