From 7d4fc79eb359263ea4239dd7cd02ab07f90971a5 Mon Sep 17 00:00:00 2001 From: George Marques Date: Thu, 9 Jan 2020 08:30:14 -0300 Subject: Add GDScript warning for standalone expression This makes the error message clearer as it might be used to call functions with side effects. --- modules/gdscript/gdscript_parser.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/gdscript/gdscript_parser.cpp') diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index fc35678e65..54e6f43917 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -8274,7 +8274,11 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { _mark_line_as_safe(op->line); _reduce_node_type(op); // Test for safety anyway #ifdef DEBUG_ENABLED - _add_warning(GDScriptWarning::STANDALONE_EXPRESSION, statement->line); + if (op->op == OperatorNode::OP_TERNARY_IF) { + _add_warning(GDScriptWarning::STANDALONE_TERNARY, statement->line); + } else { + _add_warning(GDScriptWarning::STANDALONE_EXPRESSION, statement->line); + } #endif // DEBUG_ENABLED } } -- cgit v1.2.3