summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_parser.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-04-29 16:24:38 +0200
committerGitHub <noreply@github.com>2020-04-29 16:24:38 +0200
commit39a0cdac5fa84bb9a49610acd7fc6c3b22de3979 (patch)
tree4aa5d97421da14374b66eb896a5a250754831b0f /modules/gdscript/gdscript_parser.cpp
parentb99b212855ed3d208405bf5f12f43034e5f960cf (diff)
parentbd081df51918a00f408845955d00dcbce2cea7a8 (diff)
downloadredot-engine-39a0cdac5fa84bb9a49610acd7fc6c3b22de3979.tar.gz
Merge pull request #38279 from BigRed-118/assert_mark_as_safe_regression_bug
Fix for marking assert lines as safe bug
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r--modules/gdscript/gdscript_parser.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 411512d631..a37fc579e7 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3358,15 +3358,10 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
}
if (args.empty() || args.size() > 2) {
- _set_error("Wrong number of arguments, expected 1 or 2");
+ _set_error("Wrong number of arguments, expected 1 or 2", assert_line);
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;
@@ -3383,7 +3378,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
p_block->statements.push_back(an);
if (!_end_statement()) {
- _set_error("Expected end of statement after \"assert\".");
+ _set_error("Expected end of statement after \"assert\".", assert_line);
return;
}
} break;
@@ -8133,10 +8128,15 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
Node *statement = E->get();
switch (statement->type) {
case Node::TYPE_NEWLINE:
- case Node::TYPE_BREAKPOINT:
- case Node::TYPE_ASSERT: {
+ case Node::TYPE_BREAKPOINT: {
// Nothing to do
} break;
+ case Node::TYPE_ASSERT: {
+ AssertNode *an = static_cast<AssertNode *>(statement);
+ _mark_line_as_safe(an->line);
+ _reduce_node_type(an->condition);
+ _reduce_node_type(an->message);
+ } break;
case Node::TYPE_LOCAL_VAR: {
LocalVarNode *lv = static_cast<LocalVarNode *>(statement);
lv->datatype = _resolve_type(lv->datatype, lv->line);