mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 02:21:15 +00:00
Add opt-in GDScript warning for when calling coroutine without await
This commit is contained in:
parent
ebc36a7225
commit
a3e58a385f
8 changed files with 29 additions and 2 deletions
|
|
@ -3756,8 +3756,14 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
|
|||
}
|
||||
}
|
||||
|
||||
if (call_type.is_coroutine && !p_is_await && !p_is_root) {
|
||||
push_error(vformat(R"*(Function "%s()" is a coroutine, so it must be called with "await".)*", p_call->function_name), p_call);
|
||||
if (call_type.is_coroutine && !p_is_await) {
|
||||
if (p_is_root) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
parser->push_warning(p_call, GDScriptWarning::MISSING_AWAIT);
|
||||
#endif // DEBUG_ENABLED
|
||||
} else {
|
||||
push_error(vformat(R"*(Function "%s()" is a coroutine, so it must be called with "await".)*", p_call->function_name), p_call);
|
||||
}
|
||||
}
|
||||
|
||||
p_call->set_datatype(call_type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue