Description
Describe the project you are working on
A 2D game, with several people working on it.
Describe the problem or limitation you are having in your project
Sometimes you forget to add await
when calling a coroutine, and sometimes you change an existing method to await
something, but forget to change some call site somewhere, resulting in the caller continuing execution when that might not be desirable.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Adding an opt-in warning, like for example debug/gdscript/warnings/missing_await
, where it's set to IGNORE
by default, similar to how debug/gdscript/warnings/return_value_discarded
works currently, would help resolve this problem.
Then you would (so long as there's adequate type information) get a warning for all places where you're calling a coroutine without await
, with the ability to do @warning_ignore("missing_await")
if you're absolutely sure that you want caller execution to continue at that particular call site.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I'm guessing it would from an implementation standpoint be very similar to the current RETURN_VALUE_DISCARDED
warning, where it just checks a couple of conditions in GDScriptAnalyzer::reduce_call
and emits a warning if the CallNode
isn't the child of an AwaitNode
.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Not that I'm aware of.
Is there a reason why this should be core and not an add-on in the asset library?
Same reason all the other GDScript warnings aren't.