Add GDScript warning for standalone expression
This makes the error message clearer as it might be used to call functions with side effects.
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user