Merge pull request #73291 from vonagam/fix-unsafe-weak-binop

GDScript: Fix missing unsafety mark for binary op with weak variables
This commit is contained in:
Rémi Verschelde 2023-02-20 15:41:32 +01:00
commit 6bf63a3542
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2599,6 +2599,8 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o
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.)", left_type.to_string(), right_type.to_string(), Variant::get_operator_name(p_binary_op->variant_op)), p_binary_op);
} else if (result.type_source != GDScriptParser::DataType::ANNOTATED_EXPLICIT) {
mark_node_unsafe(p_binary_op);
}
} else {
ERR_PRINT("Parser bug: unknown binary operation.");