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
This commit is contained in:
Rémi Verschelde 2019-04-01 12:17:17 +02:00 committed by GitHub
commit 4ec384f9d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);