1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add opt-in GDScript warning for when calling coroutine without await

This commit is contained in:
Mikael Hermansson
2025-06-24 14:43:50 +02:00
parent ebc36a7225
commit a3e58a385f
8 changed files with 29 additions and 2 deletions

View File

@@ -118,6 +118,8 @@ String GDScriptWarning::get_message() const {
return R"(The "@static_unload" annotation is redundant because the file does not have a class with static variables.)";
case REDUNDANT_AWAIT:
return R"("await" keyword is unnecessary because the expression isn't a coroutine nor a signal.)";
case MISSING_AWAIT:
return R"("await" keyword might be desired because the expression is a coroutine.)";
case ASSERT_ALWAYS_TRUE:
return "Assert statement is redundant because the expression is always true.";
case ASSERT_ALWAYS_FALSE:
@@ -221,6 +223,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
PNAME("MISSING_TOOL"),
PNAME("REDUNDANT_STATIC_UNLOAD"),
PNAME("REDUNDANT_AWAIT"),
PNAME("MISSING_AWAIT"),
PNAME("ASSERT_ALWAYS_TRUE"),
PNAME("ASSERT_ALWAYS_FALSE"),
PNAME("INTEGER_DIVISION"),