-
-
Notifications
You must be signed in to change notification settings - Fork 237
Refactor Enum
in codegen
#676
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
Conversation
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-676 |
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.
Thanks a lot!
Several smaller changes are hidden in the moved-around blocks, I already commented on some. If there are some I've missed and you consider worth reviewing, please mention them 🙂
This will likely break #627, but as it stands, that PR doesn't have the highest chances to get merged (Godot decision still pending). So that's probably OK. And I'd expect potential rebase effort to be reasonable.
godot-codegen/src/generator/enums.rs
Outdated
let mut enumerators = Vec::with_capacity(rust_enumerators.len()); | ||
quote! { | ||
#[repr(transparent)] | ||
#[derive(#( #derives ),*)] |
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.
Here I wonder if the whole #[derive(...)]
attribute should be stored in a variable... Or do you see a benefit in having individual derives in a list?
For example, this approach would not work in case the #derives
list is empty, whereas the other could emit an empty token-stream.
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.
Actually this would work if the #derives
list is empty, since this is perfectly legal to do:
#[derive()]
struct Foo;
and i think the code is simpler if i dont store it in a variable.
294e187
to
abd726f
Compare
abd726f
to
b7f19bc
Compare
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.
Mostly good I think, 1-2 minor things left.
b7f19bc
to
de223d0
Compare
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!
Like #673 but the codegen is kept as global functions and not inherent methods to
Enum
/Enumerator
.