mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-03 23:21:15 +00:00 
			
		
		
		
	GDScript: Remove function of continue for match statement
				
					
				
			The keyword is confusing and rarely is used in the intended way. It is removed now in favor of a future feature (pattern guards) to avoid breaking compatibility later.
This commit is contained in:
		
							parent
							
								
									2ec0da1a75
								
							
						
					
					
						commit
						9462ae4783
					
				
					 10 changed files with 5 additions and 76 deletions
				
			
		| 
						 | 
				
			
			@ -1679,7 +1679,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
 | 
			
		|||
			case GDScriptParser::Node::MATCH: {
 | 
			
		||||
				const GDScriptParser::MatchNode *match = static_cast<const GDScriptParser::MatchNode *>(s);
 | 
			
		||||
 | 
			
		||||
				gen->start_match();
 | 
			
		||||
				codegen.start_block();
 | 
			
		||||
 | 
			
		||||
				// Evaluate the match expression.
 | 
			
		||||
| 
						 | 
				
			
			@ -1718,7 +1717,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
 | 
			
		|||
 | 
			
		||||
					const GDScriptParser::MatchBranchNode *branch = match->branches[j];
 | 
			
		||||
 | 
			
		||||
					gen->start_match_branch(); // Need so lower level code can patch 'continue' jumps.
 | 
			
		||||
					codegen.start_block(); // Create an extra block around for binds.
 | 
			
		||||
 | 
			
		||||
					// Add locals in block before patterns, so temporaries don't use the stack address for binds.
 | 
			
		||||
| 
						 | 
				
			
			@ -1756,8 +1754,6 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
 | 
			
		|||
				for (int j = 0; j < match->branches.size(); j++) {
 | 
			
		||||
					gen->write_endif();
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				gen->end_match();
 | 
			
		||||
			} break;
 | 
			
		||||
			case GDScriptParser::Node::IF: {
 | 
			
		||||
				const GDScriptParser::IfNode *if_n = static_cast<const GDScriptParser::IfNode *>(s);
 | 
			
		||||
| 
						 | 
				
			
			@ -1845,12 +1841,7 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
 | 
			
		|||
				gen->write_break();
 | 
			
		||||
			} break;
 | 
			
		||||
			case GDScriptParser::Node::CONTINUE: {
 | 
			
		||||
				const GDScriptParser::ContinueNode *cont = static_cast<const GDScriptParser::ContinueNode *>(s);
 | 
			
		||||
				if (cont->is_for_match) {
 | 
			
		||||
					gen->write_continue_match();
 | 
			
		||||
				} else {
 | 
			
		||||
					gen->write_continue();
 | 
			
		||||
				}
 | 
			
		||||
				gen->write_continue();
 | 
			
		||||
			} break;
 | 
			
		||||
			case GDScriptParser::Node::RETURN: {
 | 
			
		||||
				const GDScriptParser::ReturnNode *return_n = static_cast<const GDScriptParser::ReturnNode *>(s);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue