1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

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:
George Marques
2020-01-09 08:30:14 -03:00
parent e7b7dc57fc
commit 7d4fc79eb3
3 changed files with 10 additions and 1 deletions

View File

@@ -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
}
}