-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
codgen: run the visitor on global functions as well #1313
base: main
Are you sure you want to change the base?
Conversation
otherwise glib::Priority is not replaced for them and we have to manually implement them in such case The same change is needed for Builder pattern
Do not merge yet, I will handle other cases as well first :) |
Currently, the generated builder pattern doesn't modify the priority properties to make use of glib::Priority. We can't do something like what is done for functions parameters/returns as the builder properties are computed during the analysis phase.
@@ -43,14 +43,16 @@ struct ReplaceToPriority { | |||
|
|||
impl FunctionsMutVisitor for ReplaceToPriority { | |||
fn visit_function_mut(&mut self, func: &mut Function) -> bool { | |||
if !func.name.ends_with("_async") { |
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.
Sadly this change is not great because it ends up using the glib::Priority where it doesn't make sense. Well there was only one case in gtk3-rs and another in gtk4-rs. E.g, https://docs.gtk.org/gtk3/method.TextTag.set_priority.html. Although, it drops a bunch of manual code from gtk4-rs, could be a fair trade, not sure :)
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.
will test it with gstreamer once the send on callbacks changes lands
Let me know when this is good for a review. I think changing every int that is called something with priority is not great, it will have many false positives. Maybe the functions have some other heuristic you could use? Or maybe we can have a configuration to change a parameter type to something else (don't we have that already?)? |
I think the best way going forward is to keep the detection automatic with a way to configure it per parameter/function return. It needs a bit more work for now |
@sdroege can you think of any other potential conversions we can configure like the priority one? Just thinking if we need some generic configuration like "disable_preprocess_visitor = false` or have something per type (probably unneeded) |
I don't know, sorry |
We also have conversions from an int to |
otherwise glib::Priority is not replaced for them and we have to manually implement them in such case
The same change is needed for Builder pattern