he-the-great/Juno-Windows-Class-Library — Issue #18: enums vs. flags vs. defaults
Author: Numpsy
Created: 2012-01-29 20:52:36+00:00
State: open

com.reflect contains a 'TypeAttributes' enum.

TypeImpl has an 'attr_' member of type TypeAttributes.

When Parameter.getParameters builds up the parameter list for a function, it creates an instance of TypeImpl using a constructor which just takes a type name, which means that the attr_ member is left at it's deafult value ('CoClass' , as that's the first member of the enum).

This isn't causing any issues at the moment (as tlbimpd only needs the type name to output the .d code), but while looking at issue #14 i happened to call IsCoClass() on the parameters of a function, which then of course always returns 'true'. This is a bit misleading, as the type is more 'unpopulated' at this point, so the IsXXX functions should always be false.

On a more general note, the member of TypeImpl is 'TypeAttributes', but is actually used as a set of flags (e.g. Dispatch types have it set to (TypeAttributes.Interface | TypeAttributes.InterfaceIsDispatch)). Possibly not a great idea.