diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-23 15:35:55 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-23 15:35:55 +0100 |
commit | 81fe3715b825dfc2b02adced8c08f8bc88220cb7 (patch) | |
tree | 169c2309e3b07eb827971ec36c547e9be1cc2272 /modules/gdscript/gdscript_parser.cpp | |
parent | 11e227884458e1f5661dcd27e846b6996271467e (diff) | |
parent | 9462ae47838dcee066c165fd0455a1368da5c485 (diff) |
Merge pull request #71914 from vnen/gdscript-no-continue-match
GDScript: Remove function of `continue` for match statement
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 4228046ba2..6dc63c502c 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1789,11 +1789,10 @@ GDScriptParser::BreakNode *GDScriptParser::parse_break() { GDScriptParser::ContinueNode *GDScriptParser::parse_continue() { if (!can_continue) { - push_error(R"(Cannot use "continue" outside of a loop or pattern matching block.)"); + push_error(R"(Cannot use "continue" outside of a loop.)"); } current_suite->has_continue = true; ContinueNode *cont = alloc_node<ContinueNode>(); - cont->is_for_match = is_continue_match; complete_extents(cont); end_statement(R"("continue")"); return cont; @@ -1819,12 +1818,10 @@ GDScriptParser::ForNode *GDScriptParser::parse_for() { // Save break/continue state. bool could_break = can_break; bool could_continue = can_continue; - bool was_continue_match = is_continue_match; // Allow break/continue. can_break = true; can_continue = true; - is_continue_match = false; SuiteNode *suite = alloc_node<SuiteNode>(); if (n_for->variable) { @@ -1842,7 +1839,6 @@ GDScriptParser::ForNode *GDScriptParser::parse_for() { // Reset break/continue state. can_break = could_break; can_continue = could_continue; - is_continue_match = was_continue_match; return n_for; } @@ -1979,13 +1975,6 @@ GDScriptParser::MatchBranchNode *GDScriptParser::parse_match_branch() { return nullptr; } - // Save continue state. - bool could_continue = can_continue; - bool was_continue_match = is_continue_match; - // Allow continue for match. - can_continue = true; - is_continue_match = true; - SuiteNode *suite = alloc_node<SuiteNode>(); if (branch->patterns.size() > 0) { for (const KeyValue<StringName, IdentifierNode *> &E : branch->patterns[0]->binds) { @@ -1998,10 +1987,6 @@ GDScriptParser::MatchBranchNode *GDScriptParser::parse_match_branch() { branch->block = parse_suite("match pattern block", suite); complete_extents(branch); - // Restore continue state. - can_continue = could_continue; - is_continue_match = was_continue_match; - return branch; } @@ -2160,12 +2145,10 @@ GDScriptParser::WhileNode *GDScriptParser::parse_while() { // Save break/continue state. bool could_break = can_break; bool could_continue = can_continue; - bool was_continue_match = is_continue_match; // Allow break/continue. can_break = true; can_continue = true; - is_continue_match = false; n_while->loop = parse_suite(R"("while" block)"); n_while->loop->is_loop = true; @@ -2174,7 +2157,6 @@ GDScriptParser::WhileNode *GDScriptParser::parse_while() { // Reset break/continue state. can_break = could_break; can_continue = could_continue; - is_continue_match = was_continue_match; return n_while; } |