From e99730340baed0208e513a8584637de4776d2ec0 Mon Sep 17 00:00:00 2001 From: ThreeRhinosInAnElephantCostume Date: Sat, 11 Sep 2021 20:38:15 +0200 Subject: Fix error on parsing statement-less GDScript files, add an empty file warning, add relevant tests. --- modules/gdscript/gdscript_warning.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/gdscript/gdscript_warning.cpp') 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."); -- cgit v1.2.3