You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Revert "GdScript: Use reduced constant expression result when doing binary operations. Fixes #50293"
This reverts commit 6207708607.
It broke a GDScript test (which didn't exist back when the PR was made,
so was missed prior to the merge).
It choked on:
```
prints("a", test_instance.a, test_instance.a == Named.VALUE_A)
```
With:
```
Invalid operands "VALUE_A (enum value)" and "int" for "==" operator.
```
This commit is contained in:
@@ -1867,20 +1867,12 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o
|
|||||||
|
|
||||||
GDScriptParser::DataType left_type;
|
GDScriptParser::DataType left_type;
|
||||||
if (p_binary_op->left_operand) {
|
if (p_binary_op->left_operand) {
|
||||||
if (p_binary_op->left_operand->is_constant) {
|
|
||||||
left_type = type_from_variant(p_binary_op->left_operand->reduced_value, p_binary_op->left_operand);
|
|
||||||
} else {
|
|
||||||
left_type = p_binary_op->left_operand->get_datatype();
|
left_type = p_binary_op->left_operand->get_datatype();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
GDScriptParser::DataType right_type;
|
GDScriptParser::DataType right_type;
|
||||||
if (p_binary_op->right_operand) {
|
if (p_binary_op->right_operand) {
|
||||||
if (p_binary_op->right_operand->is_constant) {
|
|
||||||
right_type = type_from_variant(p_binary_op->right_operand->reduced_value, p_binary_op->right_operand);
|
|
||||||
} else {
|
|
||||||
right_type = p_binary_op->right_operand->get_datatype();
|
right_type = p_binary_op->right_operand->get_datatype();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!left_type.is_set() || !right_type.is_set()) {
|
if (!left_type.is_set() || !right_type.is_set()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user