summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-09-30 18:56:33 +0200
committerRémi Verschelde <rverschelde@gmail.com>2021-09-30 18:57:59 +0200
commitd2b8560d7a871a7bab27e68835f86e69e47e79ad (patch)
tree38c4a960b0cd2379ca6628cdf69ac7e1f97da749 /modules/gdscript/gdscript_analyzer.cpp
parent767bde8c28fb09fb1e08f94d8b67076d4b7c4085 (diff)
downloadredot-engine-d2b8560d7a871a7bab27e68835f86e69e47e79ad.tar.gz
Revert "GdScript: Use reduced constant expression result when doing binary operations. Fixes #50293"
This reverts commit 62077086076fb99fb7fe014522c44ae83f87dc4d. 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. ```
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 2485e9f432..032e08f5a0 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -1867,19 +1867,11 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o
GDScriptParser::DataType left_type;
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;
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()) {