codgen: run the visitor on global functions as well#1313
codgen: run the visitor on global functions as well#1313bilelmoussaoui wants to merge 3 commits intomainfrom
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.
|
|
||
| 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.
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.
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