From 3bd5fc2e5ece4708850e8fa7da3c0b8eb3fd669c Mon Sep 17 00:00:00 2001 From: Tom Evans Date: Mon, 23 Mar 2020 21:24:24 -0500 Subject: [PATCH] Mark assert lines as safe in gdscript Now calling _reduce_node_type with debugging enabled to determine if assert line is safe. Part of doing this required the assert line to be stored away. Now the AssertNode line is being correctly set. Newlines are now marked safe always (cherry picked from commit 8dc883378218f85c7d3080e6769fac7a957c5223) --- modules/gdscript/gdscript_parser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index e9c9c66d87a..347aab06856 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2787,6 +2787,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { return; } + _mark_line_as_safe(line); NewLineNode *nl2 = alloc_node(); nl2->line = line; p_block->statements.push_back(nl2); @@ -3300,6 +3301,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { return; } + int assert_line = tokenizer->get_token_line(); + tokenizer->advance(); Vector args; @@ -3313,8 +3316,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(); an->condition = _reduce_expression(args[0], p_static); + an->line = assert_line; if (args.size() == 2) { an->message = _reduce_expression(args[1], p_static);