diff options
author | Tom Evans <tevans1863@gmail.com> | 2020-03-23 21:24:24 -0500 |
---|---|---|
committer | Tom Evans <tevans1863@gmail.com> | 2020-03-25 08:42:04 -0500 |
commit | 8dc883378218f85c7d3080e6769fac7a957c5223 (patch) | |
tree | a8866da2c37c60b3adfebdbde35fc1125083e7a3 /modules | |
parent | 20edf69f96160fcf7c0ea2449f4daf50f572ce99 (diff) |
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
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 7fcb2cc423..89e4a13706 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2785,6 +2785,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); @@ -3299,6 +3300,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { return; } + int assert_line = tokenizer->get_token_line(); + tokenizer->advance(); Vector<Node *> args; @@ -3312,8 +3315,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); |