mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Merge pull request #110240 from westenral/add_int_division_warnings
Add checks for integer vectors for integer division warning
This commit is contained in:
commit
b9730c0b2e
1 changed files with 7 additions and 1 deletions
|
@ -3102,7 +3102,13 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o
|
|||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (p_binary_op->variant_op == Variant::OP_DIVIDE && left_type.builtin_type == Variant::INT && right_type.builtin_type == Variant::INT) {
|
||||
if (p_binary_op->variant_op == Variant::OP_DIVIDE &&
|
||||
(left_type.builtin_type == Variant::INT ||
|
||||
left_type.builtin_type == Variant::VECTOR2I ||
|
||||
left_type.builtin_type == Variant::VECTOR3I ||
|
||||
left_type.builtin_type == Variant::VECTOR4I) &&
|
||||
(right_type.builtin_type == Variant::INT ||
|
||||
right_type.builtin_type == left_type.builtin_type)) {
|
||||
parser->push_warning(p_binary_op, GDScriptWarning::INTEGER_DIVISION);
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue