From b7e644bd26f270d34b81cfe2e76c28ff5241527a Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Tue, 27 Aug 2019 23:10:33 -0300 Subject: [PATCH] Make 'break' and 'continue' be marked as safe (cherry picked from commit a8826ad3b8cececd6e49fc2caaed56b3f220333d) --- modules/gdscript/gdscript_parser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 1223e81be4e..87b63fdbf97 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2768,12 +2768,12 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { _mark_line_as_safe(tokenizer->get_token_line()); tokenizer->advance(); if (tokenizer->get_token() == GDScriptTokenizer::TK_SEMICOLON) { - // Ignore semicolon after 'pass' + // Ignore semicolon after 'pass'. tokenizer->advance(); } } break; case GDScriptTokenizer::TK_PR_VAR: { - //variale declaration and (eventual) initialization + // Variable declaration and (eventual) initialization. tokenizer->advance(); int var_line = tokenizer->get_token_line(); @@ -3174,6 +3174,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { } break; case GDScriptTokenizer::TK_CF_CONTINUE: { + _mark_line_as_safe(tokenizer->get_token_line()); tokenizer->advance(); ControlFlowNode *cf_continue = alloc_node(); cf_continue->cf_type = ControlFlowNode::CF_CONTINUE; @@ -3185,6 +3186,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { } break; case GDScriptTokenizer::TK_CF_BREAK: { + _mark_line_as_safe(tokenizer->get_token_line()); tokenizer->advance(); ControlFlowNode *cf_break = alloc_node(); cf_break->cf_type = ControlFlowNode::CF_BREAK;