-
Notifications
You must be signed in to change notification settings - Fork 361
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
Support enums defined in C++ code. #187
Conversation
This allows listing an enum in an extern "C" block as well as in the shared block. In this case, we do not emit the C++ declaration of the enum but instead emit static assertions that it has the values that we expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I filed #188 to follow up on a test harness that is able to cover static_asserts.
I think the goal of the representation under crate::syntax::Api would be to be useful to the later compiler stages (check.rs, expand.rs + write.rs), not necessarily to be close to the source. That means normalizing all insignificant differences. For example:
|
That makes sense. I'll follow up with that tomorrow. |
This allows listing an enum in an extern "C" block as well as in the shared block. In this case, we do not emit the C++ declaration of the enum but instead emit static assertions that it has the values that we expect.
Do you know a good way to test the assertions? The ui tests don't seem to compile the generated C++ files, so I'm not sure how to do it.
I'm also considering refactoring the discriminant generation code somewhere now that it's mostly duplicated in three different places.
Closes #177.