godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.7k stars 525 forks source link

Fix incorrect generation of some C++ operators #1557

Closed mihe closed 1 month ago

mihe commented 1 month ago

Fixes #1556.

This fixes the generation of operator!, operator&& and operator||, as they were not being mapped correctly from their extension_api.json name of not, and and or respectively, resulting in them showing up as operatornot, operatorand and operatoror respectively.

Note that operatorand and operatoror never actually showed up anywhere in the generated C++ headers, as they only exist on built-in types in extension_api.json currently.

I also fixed another related issue, which is that the ** operator wasn't being skipped like the in and xor operators have been until now, neither of which make no sense in C++ of course. This is now done through a new helper function called is_valid_cpp_operator.

I suppose this is technically a breaking change, so I'm not sure if there's perhaps some argument for leaving the old operatornot methods intact.

dsnopek commented 3 weeks ago

Cherry-picked for 4.3 in PR https://github.com/godotengine/godot-cpp/pull/1569

dsnopek commented 3 weeks ago

Cherry-picked for 4.2 in PR https://github.com/godotengine/godot-cpp/pull/1570

dsnopek commented 3 weeks ago

Cherry-picked for 4.1 in PR https://github.com/godotengine/godot-cpp/pull/1572