summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_warning.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-13 17:30:31 +0200
committerGitHub <noreply@github.com>2021-09-13 17:30:31 +0200
commit4059cf2f02f7c8d9c79ca66a477b34e0e0cc6b62 (patch)
tree2257f8558ad44f103c87dcb526d5b9c252006307 /modules/gdscript/gdscript_warning.cpp
parent41562b91982074a4ab9c1f151cca1ec0681fc356 (diff)
parente99730340baed0208e513a8584637de4776d2ec0 (diff)
Merge pull request #52068 from ThreeRhinosInAnElephantCostume/fixgdscript
Fix parse error on statement-less files with only newlines, add a warning for empty files.
Diffstat (limited to 'modules/gdscript/gdscript_warning.cpp')
-rw-r--r--modules/gdscript/gdscript_warning.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_warning.cpp b/modules/gdscript/gdscript_warning.cpp
index ad41b60a4e..7a483a16ba 100644
--- a/modules/gdscript/gdscript_warning.cpp
+++ b/modules/gdscript/gdscript_warning.cpp
@@ -145,6 +145,9 @@ String GDScriptWarning::get_message() const {
case REDUNDANT_AWAIT: {
return R"("await" keyword not needed in this case, because the expression isn't a coroutine nor a signal.)";
}
+ case EMPTY_FILE: {
+ return "Empty script file.";
+ }
case WARNING_MAX:
break; // Can't happen, but silences warning
}
@@ -190,6 +193,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
"ASSERT_ALWAYS_TRUE",
"ASSERT_ALWAYS_FALSE",
"REDUNDANT_AWAIT",
+ "EMPTY_FILE",
};
static_assert((sizeof(names) / sizeof(*names)) == WARNING_MAX, "Amount of warning types don't match the amount of warning names.");