-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
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
Port existing _notification
code to use switch
statements instead of if
#58155
Comments
I can take chunk A if it's OK for you. |
@akien-mga Should we remove empty default case ? default: break; |
Yeah I think so. I don't see any reason to have them in |
I can do chunk B |
Never touched C++ before, but I want to learn it. I can do Chunk C, unless you'd prefer people who already used C++. |
Feel free to give it a try, it can be a good way to learn some syntax. Don't hesitate to join the Godot Chat if you have questions on how to handle some parts. Depending on the situations, it might require some understanding of how C++ |
I've used switch statements before, I assume that the implicit fallthrough would be like the first case in the example in #58151? I'm familiar with |
|
All done, thanks @jmb462 @megalobyte @jakobbouchard! |
Godot version
4.0.dev (98b97d3)
Issue description
Following #58151, the rest of the codebase should be given the same treatment to review all
_notification
methods and ensure that they useswitch
statements instead of a list ofif (p_what == NOTIFICATION_*)
.See the above PR for details of what the preferred style should be like.
#58151 handled all code in
scene
, so what remains is the following. I split it in 3 chunks of approximately similar size.If you want to work on this issue, please comment to indicate which chunk you're working on to avoid having multiple contributors do the same chunks.
Note: Those are the list of files with the string
::notification(
, some of them might already be usingswitch
statements and just need a quick touch-up (adding separation lines if missing, ensuring they use code blocks andbreak;
).The text was updated successfully, but these errors were encountered: