GDScript: Add missing static default initialization for typed dictionaries
This commit is contained in:
parent
92e51fca72
commit
0bc59c78de
1 changed files with 7 additions and 1 deletions
|
@ -693,10 +693,16 @@ void GDScript::_static_default_init() {
|
|||
continue;
|
||||
}
|
||||
if (type.builtin_type == Variant::ARRAY && type.has_container_element_type(0)) {
|
||||
const GDScriptDataType element_type = type.get_container_element_type(0);
|
||||
Array default_value;
|
||||
const GDScriptDataType &element_type = type.get_container_element_type(0);
|
||||
default_value.set_typed(element_type.builtin_type, element_type.native_type, element_type.script_type);
|
||||
static_variables.write[E.value.index] = default_value;
|
||||
} else if (type.builtin_type == Variant::DICTIONARY && type.has_container_element_types()) {
|
||||
const GDScriptDataType key_type = type.get_container_element_type_or_variant(0);
|
||||
const GDScriptDataType value_type = type.get_container_element_type_or_variant(1);
|
||||
Dictionary default_value;
|
||||
default_value.set_typed(key_type.builtin_type, key_type.native_type, key_type.script_type, value_type.builtin_type, value_type.native_type, value_type.script_type);
|
||||
static_variables.write[E.value.index] = default_value;
|
||||
} else {
|
||||
Variant default_value;
|
||||
Callable::CallError err;
|
||||
|
|
Loading…
Reference in a new issue