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

Method add_temporary

modules/gdscript/gdscript_byte_codegen.cpp:74–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74uint32_t GDScriptByteCodeGenerator::add_temporary(const GDScriptDataType &p_type) {
75 Variant::Type temp_type = Variant::NIL;
76 if (p_type.has_type && p_type.kind == GDScriptDataType::BUILTIN) {
77 switch (p_type.builtin_type) {
78 case Variant::NIL:
79 case Variant::BOOL:
80 case Variant::INT:
81 case Variant::FLOAT:
82 case Variant::STRING:
83 case Variant::VECTOR2:
84 case Variant::VECTOR2I:
85 case Variant::RECT2:
86 case Variant::RECT2I:
87 case Variant::VECTOR3:
88 case Variant::VECTOR3I:
89 case Variant::TRANSFORM2D:
90 case Variant::VECTOR4:
91 case Variant::VECTOR4I:
92 case Variant::PLANE:
93 case Variant::QUATERNION:
94 case Variant::AABB:
95 case Variant::BASIS:
96 case Variant::TRANSFORM3D:
97 case Variant::PROJECTION:
98 case Variant::COLOR:
99 case Variant::STRING_NAME:
100 case Variant::NODE_PATH:
101 case Variant::RID:
102 case Variant::CALLABLE:
103 case Variant::SIGNAL:
104 temp_type = p_type.builtin_type;
105 break;
106 case Variant::OBJECT:
107 case Variant::DICTIONARY:
108 case Variant::ARRAY:
109 case Variant::PACKED_BYTE_ARRAY:
110 case Variant::PACKED_INT32_ARRAY:
111 case Variant::PACKED_INT64_ARRAY:
112 case Variant::PACKED_FLOAT32_ARRAY:
113 case Variant::PACKED_FLOAT64_ARRAY:
114 case Variant::PACKED_STRING_ARRAY:
115 case Variant::PACKED_VECTOR2_ARRAY:
116 case Variant::PACKED_VECTOR3_ARRAY:
117 case Variant::PACKED_COLOR_ARRAY:
118 case Variant::PACKED_VECTOR4_ARRAY:
119 case Variant::VARIANT_MAX:
120 // Arrays, dictionaries, and objects are reference counted, so we don't use the pool for them.
121 temp_type = Variant::NIL;
122 break;
123 }
124 }
125
126 if (!temporaries_pool.has(temp_type)) {
127 temporaries_pool[temp_type] = List<int>();
128 }
129
130 List<int> &pool = temporaries_pool[temp_type];
131 if (pool.is_empty()) {

Callers 4

_parse_expressionMethod · 0.45
_parse_match_patternMethod · 0.45
_parse_blockMethod · 0.45

Calls 8

can_contain_objectMethod · 0.80
sizeMethod · 0.65
hasMethod · 0.45
is_emptyMethod · 0.45
push_backMethod · 0.45
getMethod · 0.45
frontMethod · 0.45
pop_frontMethod · 0.45

Tested by

no test coverage detected