mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 21:51:22 +00:00 
			
		
		
		
	Merge pull request #37265 from BigRed-118/mark_assert_safe
Mark assert lines as safe in gdscript
This commit is contained in:
		
						commit
						39f77f95b8
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		|  | @ -2801,6 +2801,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { | |||
| 					return; | ||||
| 				} | ||||
| 
 | ||||
| 				_mark_line_as_safe(line); | ||||
| 				NewLineNode *nl2 = alloc_node<NewLineNode>(); | ||||
| 				nl2->line = line; | ||||
| 				p_block->statements.push_back(nl2); | ||||
|  | @ -3314,6 +3315,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { | |||
| 					return; | ||||
| 				} | ||||
| 
 | ||||
| 				int assert_line = tokenizer->get_token_line(); | ||||
| 
 | ||||
| 				tokenizer->advance(); | ||||
| 
 | ||||
| 				Vector<Node *> args; | ||||
|  | @ -3327,8 +3330,14 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { | |||
| 					return; | ||||
| 				} | ||||
| 
 | ||||
| #ifdef DEBUG_ENABLED | ||||
| 				// Mark as safe, let type check mark as unsafe if needed
 | ||||
| 				_mark_line_as_safe(assert_line); | ||||
| 				_reduce_node_type(args[0]); | ||||
| #endif | ||||
| 				AssertNode *an = alloc_node<AssertNode>(); | ||||
| 				an->condition = _reduce_expression(args[0], p_static); | ||||
| 				an->line = assert_line; | ||||
| 
 | ||||
| 				if (args.size() == 2) { | ||||
| 					an->message = _reduce_expression(args[1], p_static); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Rémi Verschelde
						Rémi Verschelde