gtkd-developers / gir-to-d

Create D bindings from GObject introspection files
GNU Lesser General Public License v3.0
23 stars 13 forks source link

wrongly adding override when name of function matches parent class (but not return type) #40

Open WebFreak001 opened 2 years ago

WebFreak001 commented 2 years ago

Example: Gtk.Widget defines gtk.c.types.GtkTextDirection gtk.Widget.Widget.getDirection() Libadwaita (Adw-1.gir) defines GtkArrowType getDirection()

girtod marks the method as override

WebFreak001 commented 2 years ago

D doesn't allow redefining functions with different return type.

To work around this you can use

public GtkArrowType _getDirection() { ... }
alias getDirection = _getDirection; // makes getDirection calls on this type call this function

however this could lead to confusion. Manually disabling code for the function and reimplementing works, but something easier in girtod (like a command to rename functions)

MikeWey commented 2 years ago

(like a command to rename functions)

You can use alias to rename the function:

alias: get_direction _getDirection
WebFreak001 commented 2 years ago

ah ok thanks, I didn't see that in the readme for functions, but it's there under global - didn't think replace ctype with dtype would apply to function names as well