mirror of
https://github.com/godotengine/godot.git
synced 2025-01-18 20:40:57 +08:00
Merge pull request #41062 from ThakeeNathees/unsafe-arithmatic-assignment-bug-fix
GDScript: unsafe arithmetic assignment bug fix
This commit is contained in:
commit
241e709462
@ -1406,6 +1406,7 @@ void GDScriptAnalyzer::reduce_assignment(GDScriptParser::AssignmentNode *p_assig
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!p_assignment->assignee->get_datatype().is_variant() && !p_assignment->assigned_value->get_datatype().is_variant()) {
|
||||||
bool compatible = true;
|
bool compatible = true;
|
||||||
GDScriptParser::DataType op_type = p_assignment->assigned_value->get_datatype();
|
GDScriptParser::DataType op_type = p_assignment->assigned_value->get_datatype();
|
||||||
if (vop != Variant::OP_EQUAL) {
|
if (vop != Variant::OP_EQUAL) {
|
||||||
@ -1424,6 +1425,7 @@ void GDScriptAnalyzer::reduce_assignment(GDScriptParser::AssignmentNode *p_assig
|
|||||||
} else {
|
} else {
|
||||||
push_error(vformat(R"(Invalid operands "%s" and "%s" for assignment operator.)", p_assignment->assignee->get_datatype().to_string(), p_assignment->assigned_value->get_datatype().to_string()), p_assignment);
|
push_error(vformat(R"(Invalid operands "%s" and "%s" for assignment operator.)", p_assignment->assignee->get_datatype().to_string(), p_assignment->assigned_value->get_datatype().to_string()), p_assignment);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (p_assignment->assignee->get_datatype().has_no_type() || p_assignment->assigned_value->get_datatype().is_variant()) {
|
if (p_assignment->assignee->get_datatype().has_no_type() || p_assignment->assigned_value->get_datatype().is_variant()) {
|
||||||
mark_node_unsafe(p_assignment);
|
mark_node_unsafe(p_assignment);
|
||||||
|
Loading…
Reference in New Issue
Block a user