mirror of
https://github.com/godotengine/godot.git
synced 2025-02-05 21:41:47 +08:00
Fix unreachable code warning for elif block
This commit is contained in:
parent
a43db5afa4
commit
2b60d9d6e1
@ -1865,10 +1865,18 @@ GDScriptParser::IfNode *GDScriptParser::parse_if(const String &p_token) {
|
||||
|
||||
if (match(GDScriptTokenizer::Token::ELIF)) {
|
||||
SuiteNode *else_block = alloc_node<SuiteNode>();
|
||||
else_block->parent_function = current_function;
|
||||
else_block->parent_block = current_suite;
|
||||
|
||||
SuiteNode *previous_suite = current_suite;
|
||||
current_suite = else_block;
|
||||
|
||||
IfNode *elif = parse_if("elif");
|
||||
else_block->statements.push_back(elif);
|
||||
complete_extents(else_block);
|
||||
n_if->false_block = else_block;
|
||||
|
||||
current_suite = previous_suite;
|
||||
} else if (match(GDScriptTokenizer::Token::ELSE)) {
|
||||
consume(GDScriptTokenizer::Token::COLON, R"(Expected ":" after "else".)");
|
||||
n_if->false_block = parse_suite(R"("else" block)");
|
||||
|
Loading…
Reference in New Issue
Block a user