diff options
author | George Marques <george@gmarqu.es> | 2021-06-18 17:18:44 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-18 17:18:44 -0300 |
commit | c4fcc678dfab1b60f73ad6044353de4116b814f7 (patch) | |
tree | a52de692d566c4d32c51e51bbcc91a8261d19ef9 /modules/gdscript/gdscript_analyzer.cpp | |
parent | df170c8af05c7e81a83ddae4e4d62c65d7086bc3 (diff) | |
parent | 6449c5f2464076ab51d4955bf5b8e627beefb8ce (diff) | |
download | redot-engine-c4fcc678dfab1b60f73ad6044353de4116b814f7.tar.gz |
Merge pull request #49449 from SpectralDragon/fix-enum-equal-operation
Fix equal operation for typed enums
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index c3edc813d2..2c848cb1de 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1779,10 +1779,10 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o } else { if (p_binary_op->variant_op < Variant::OP_MAX) { bool valid = false; - result = get_operation_type(p_binary_op->variant_op, p_binary_op->left_operand->get_datatype(), right_type, valid, p_binary_op); + result = get_operation_type(p_binary_op->variant_op, left_type, right_type, valid, p_binary_op); if (!valid) { - push_error(vformat(R"(Invalid operands "%s" and "%s" for "%s" operator.)", p_binary_op->left_operand->get_datatype().to_string(), right_type.to_string(), Variant::get_operator_name(p_binary_op->variant_op)), p_binary_op); + push_error(vformat(R"(Invalid operands "%s" and "%s" for "%s" operator.)", left_type.to_string(), right_type.to_string(), Variant::get_operator_name(p_binary_op->variant_op)), p_binary_op); } } else { if (p_binary_op->operation == GDScriptParser::BinaryOpNode::OP_TYPE_TEST) { @@ -2349,6 +2349,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod GDScriptParser::DataType result; result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; result.kind = GDScriptParser::DataType::ENUM_VALUE; + result.builtin_type = base.builtin_type; result.native_type = base.native_type; result.enum_type = name; p_identifier->set_datatype(result); |