On 7/21/12 8:46 PM, Andrej Mitrovic wrote:
On 7/21/12, Andrei Alexandrescu<seewebsiteforem...@erdani.org> wrote:
class ModuleInfo {
@property:
string name();
ImportInfo[] imports();
DataInfo[] data();
FunctionInfo[] functions();
ClassInfo[] classes();
StructInfo[] structs(); // includes unions
TemplateInfo[] templates();
EnumInfo[] enums();
bool hasStaticCtor(), hasStaticDtor(),
hasSharedCtor(), hasSharedDtor();
}
Are class/struct/function/etc templates going to be stored in the
templates field? Then you'd have to tag each template with a type,
e.g. "class template" vs "function template" to be able to filter them
out.
Perhaps we could accommodate parameterized types together with
non-parameterized types by having e.g. additional properties that are
null for non-parameterized types.
Otherwise classes/functions/etc could have an optional
"TemplateTypeInfo[] typeParams" field so you could filter out
templated from non-templated types by checking their typeParams field,
e.g.: auto tempClasses = filter!(a => !empty(a.typeParams)
)(modinfo.classes);
I use a similar structure to what you've defined for my code generator
and it worked out nicely for me.
That sounds great!
Andrei