Skip to content

Do not generate TypeDef for enum #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

kornilova203
Copy link
Member

Generated typedefs are confusing.
The PR removes generated typedefs for enums.

If a field/parameter/variable has enum type, it references an Enum instance directly.

Also generated typedefs make #61 difficult to implement because enums and typedefs should be matched (in order to output enumerators right below enum type). It can be done by going through all typedefs, but it does not look good.

@kornilova203 kornilova203 force-pushed the do-not-generate-typedef-for-enum branch from a268188 to 673b22e Compare August 8, 2018 18:48
Copy link
Member

@jonas jonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment otherwise looks good.

type toggle_e = enum_toggle_e
type int2int = native.CFunctionPtr1[native.CInt, native.CInt]
type day2string = native.CFunctionPtr1[enum_days, native.CString]
type toggle = native.CFunctionPtr1[toggle_e, Unit]
type enum_days = native.CUnsignedInt
type enum_toggle_e = native.CUnsignedInt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest enums are before function pointers, typedefs and records.

@kornilova203 kornilova203 force-pushed the do-not-generate-typedef-for-enum branch from 673b22e to e2777eb Compare August 9, 2018 08:24
@kornilova203 kornilova203 merged commit d97e6b9 into master Aug 9, 2018
@kornilova203 kornilova203 deleted the do-not-generate-typedef-for-enum branch August 9, 2018 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants