summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_parser.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-30 20:27:12 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-30 20:27:12 +0100
commitdc7fb3048591faa68f906b2bc01b15c443613cb6 (patch)
tree400af1fd55c7eb37d5f8a0c4f224d6ae88a800a5 /modules/gdscript/gdscript_parser.cpp
parent73c1fa98266c112ea5388501ff6e5c7e325a0207 (diff)
parent65407dd42d9161b62d971095f21248f3b708f2b3 (diff)
Merge pull request #72400 from vnen/gdscript-match-release-consistency
GDScript: Fix match branches return check on release
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r--modules/gdscript/gdscript_parser.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 06c66b155f..66374d0a6d 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -1906,10 +1906,8 @@ GDScriptParser::MatchNode *GDScriptParser::parse_match() {
return match;
}
-#ifdef DEBUG_ENABLED
bool all_have_return = true;
bool have_wildcard = false;
-#endif
while (!check(GDScriptTokenizer::Token::DEDENT) && !is_at_end()) {
MatchBranchNode *branch = parse_match_branch();
@@ -1922,21 +1920,19 @@ GDScriptParser::MatchNode *GDScriptParser::parse_match() {
if (have_wildcard && !branch->patterns.is_empty()) {
push_warning(branch->patterns[0], GDScriptWarning::UNREACHABLE_PATTERN);
}
+#endif
have_wildcard = have_wildcard || branch->has_wildcard;
all_have_return = all_have_return && branch->block->has_return;
-#endif
match->branches.push_back(branch);
}
complete_extents(match);
consume(GDScriptTokenizer::Token::DEDENT, R"(Expected an indented block after "match" statement.)");
-#ifdef DEBUG_ENABLED
if (all_have_return && have_wildcard) {
current_suite->has_return = true;
}
-#endif
return match;
}