MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / write_assign

Method write_assign

modules/gdscript/gdscript_byte_codegen.cpp:976–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974}
975
976void GDScriptByteCodeGenerator::write_assign(const Address &p_target, const Address &p_source) {
977 if (p_target.type.kind == GDScriptDataType::BUILTIN && p_target.type.builtin_type == Variant::ARRAY && p_target.type.has_container_element_type(0)) {
978 const GDScriptDataType &element_type = p_target.type.get_container_element_type(0);
979 append_opcode(GDScriptFunction::OPCODE_ASSIGN_TYPED_ARRAY);
980 append(p_target);
981 append(p_source);
982 append(get_constant_pos(element_type.script_type) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS));
983 append(element_type.builtin_type);
984 append(element_type.native_type);
985 } else if (p_target.type.kind == GDScriptDataType::BUILTIN && p_target.type.builtin_type == Variant::DICTIONARY && p_target.type.has_container_element_types()) {
986 const GDScriptDataType &key_type = p_target.type.get_container_element_type_or_variant(0);
987 const GDScriptDataType &value_type = p_target.type.get_container_element_type_or_variant(1);
988 append_opcode(GDScriptFunction::OPCODE_ASSIGN_TYPED_DICTIONARY);
989 append(p_target);
990 append(p_source);
991 append(get_constant_pos(key_type.script_type) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS));
992 append(get_constant_pos(value_type.script_type) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS));
993 append(key_type.builtin_type);
994 append(key_type.native_type);
995 append(value_type.builtin_type);
996 append(value_type.native_type);
997 } else if (p_target.type.kind == GDScriptDataType::BUILTIN && p_source.type.kind == GDScriptDataType::BUILTIN && p_target.type.builtin_type != p_source.type.builtin_type) {
998 // Need conversion.
999 append_opcode(GDScriptFunction::OPCODE_ASSIGN_TYPED_BUILTIN);
1000 append(p_target);
1001 append(p_source);
1002 append(p_target.type.builtin_type);
1003 } else {
1004 append_opcode(GDScriptFunction::OPCODE_ASSIGN);
1005 append(p_target);
1006 append(p_source);
1007 }
1008}
1009
1010void GDScriptByteCodeGenerator::write_assign_null(const Address &p_target) {
1011 append_opcode(GDScriptFunction::OPCODE_ASSIGN_NULL);

Callers 5

_parse_expressionMethod · 0.80
_parse_match_patternMethod · 0.80
_parse_blockMethod · 0.80
_parse_functionMethod · 0.80

Tested by

no test coverage detected