@@ -448,6 +448,10 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
448448 result .append (f"\t const Variant &operator[](int p_index) const;" )
449449 result .append (f"\t Variant &operator[](int p_index);" )
450450
451+ if class_name == "Dictionary" :
452+ result .append (f"\t const Variant &operator[](const Variant &p_key) const;" )
453+ result .append (f"\t Variant &operator[](const Variant &p_key);" )
454+
451455 result .append ("};" )
452456
453457 if class_name == "String" :
@@ -607,7 +611,10 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
607611
608612 # Move constructor.
609613 result .append (f"{ class_name } ::{ class_name } ({ class_name } &&other) {{" )
610- result .append ("\t std::swap(opaque, other.opaque);" )
614+ if needs_copy_instead_of_move (class_name ) and copy_constructor_index >= 0 :
615+ result .append (f"\t internal::_call_builtin_constructor(_method_bindings.constructor_{ copy_constructor_index } , &opaque, &other);" )
616+ else :
617+ result .append ("\t std::swap(opaque, other.opaque);" )
611618 result .append ("}" )
612619 result .append ("" )
613620
@@ -722,7 +729,10 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
722729
723730 # Move assignment.
724731 result .append (f"{ class_name } &{ class_name } ::operator=({ class_name } &&other) {{" )
725- result .append ("\t std::swap(opaque, other.opaque);" )
732+ if needs_copy_instead_of_move (class_name ) and copy_constructor_index >= 0 :
733+ result .append (f"\t internal::_call_builtin_constructor(_method_bindings.constructor_{ copy_constructor_index } , &opaque, &other);" )
734+ else :
735+ result .append ("\t std::swap(opaque, other.opaque);" )
726736 result .append ("\t return *this;" )
727737 result .append ("}" )
728738
@@ -1560,6 +1570,13 @@ def is_packed_array(type_name):
15601570 "PackedVector3Array" ,
15611571 ]
15621572
1573+ def needs_copy_instead_of_move (type_name ):
1574+ """
1575+ Those are types which need initialised data or we'll get warning spam so need a copy instead of move.
1576+ """
1577+ return type_name in [
1578+ "Dictionary" ,
1579+ ]
15631580
15641581def is_enum (type_name ):
15651582 return type_name .startswith ("enum::" )
0 commit comments