diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-01 12:17:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-01 12:17:17 +0200 |
commit | 4ec384f9d4d1d89a14d95c10fd52306e6c023a0f (patch) | |
tree | 6839b5f8c7c3ede2b0f0d3d4dc212db63da034c4 /modules/gdscript | |
parent | 934714248480dfe5caa87404591ec81631936653 (diff) | |
parent | 79176decd5dcbe7abc938458864f2191757b07dc (diff) |
Merge pull request #26097 from danielspaniol/25955-wrong-unreachable-warning-after-returning-from-matchs-wildcard-pattern
Fix: Wrong unreachable warning after returning from match's wildcard pattern #25955
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index da69181a43..6b7379d350 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2225,6 +2225,8 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) { void GDScriptParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode *> &p_branches, bool p_static) { int indent_level = tab_level.back()->get(); + p_block->has_return = true; + while (true) { while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE && _parse_newline()) @@ -2282,8 +2284,8 @@ void GDScriptParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBran current_block = p_block; - if (catch_all && branch->body->has_return) { - p_block->has_return = true; + if (!branch->body->has_return) { + p_block->has_return = false; } p_branches.push_back(branch); |