Skip to content

enums vs. flags vs. defaults #18

@Numpsy

Description

@Numpsy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions