GDScript: Add missing type conversions in for range
This commit is contained in:
parent
51b0379e55
commit
e2d4469dc2
@ -1585,9 +1585,21 @@ void GDScriptByteCodeGenerator::write_for_range_assignment(const Address &p_from
|
|||||||
const Address &range_step = for_range_step_variables.back()->get();
|
const Address &range_step = for_range_step_variables.back()->get();
|
||||||
|
|
||||||
// Assign range args.
|
// Assign range args.
|
||||||
write_assign(range_from, p_from);
|
if (range_from.type == p_from.type) {
|
||||||
write_assign(range_to, p_to);
|
write_assign(range_from, p_from);
|
||||||
write_assign(range_step, p_step);
|
} else {
|
||||||
|
write_assign_with_conversion(range_from, p_from);
|
||||||
|
}
|
||||||
|
if (range_to.type == p_to.type) {
|
||||||
|
write_assign(range_to, p_to);
|
||||||
|
} else {
|
||||||
|
write_assign_with_conversion(range_to, p_to);
|
||||||
|
}
|
||||||
|
if (range_step.type == p_step.type) {
|
||||||
|
write_assign(range_step, p_step);
|
||||||
|
} else {
|
||||||
|
write_assign_with_conversion(range_step, p_step);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GDScriptByteCodeGenerator::write_for(const Address &p_variable, bool p_use_conversion, bool p_is_range) {
|
void GDScriptByteCodeGenerator::write_for(const Address &p_variable, bool p_use_conversion, bool p_is_range) {
|
||||||
|
@ -234,6 +234,19 @@ public:
|
|||||||
|
|
||||||
GDScriptDataType() = default;
|
GDScriptDataType() = default;
|
||||||
|
|
||||||
|
bool operator==(const GDScriptDataType &p_other) const {
|
||||||
|
return kind == p_other.kind &&
|
||||||
|
has_type == p_other.has_type &&
|
||||||
|
builtin_type == p_other.builtin_type &&
|
||||||
|
native_type == p_other.native_type &&
|
||||||
|
(script_type == p_other.script_type || script_type_ref == p_other.script_type_ref) &&
|
||||||
|
container_element_types == p_other.container_element_types;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const GDScriptDataType &p_other) const {
|
||||||
|
return !(*this == p_other);
|
||||||
|
}
|
||||||
|
|
||||||
void operator=(const GDScriptDataType &p_other) {
|
void operator=(const GDScriptDataType &p_other) {
|
||||||
kind = p_other.kind;
|
kind = p_other.kind;
|
||||||
has_type = p_other.has_type;
|
has_type = p_other.has_type;
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
# GH-83293
|
|
||||||
|
|
||||||
func test():
|
func test():
|
||||||
|
# GH-83293
|
||||||
for x in range(1 << 31, (1 << 31) + 3):
|
for x in range(1 << 31, (1 << 31) + 3):
|
||||||
print(x)
|
print(x)
|
||||||
for x in range(1 << 62, (1 << 62) + 3):
|
for x in range(1 << 62, (1 << 62) + 3):
|
||||||
print(x)
|
print(x)
|
||||||
|
|
||||||
|
# GH-107392
|
||||||
|
var n = 1.0
|
||||||
|
for x in range(n):
|
||||||
|
print(x)
|
@ -5,3 +5,4 @@ GDTEST_OK
|
|||||||
4611686018427387904
|
4611686018427387904
|
||||||
4611686018427387905
|
4611686018427387905
|
||||||
4611686018427387906
|
4611686018427387906
|
||||||
|
0
|
Loading…
x
Reference in New Issue
Block a user