Add type validations when setting basic type
This commit is contained in:
parent
67db681871
commit
47f0cf7460
3 changed files with 8 additions and 0 deletions
|
@ -1400,6 +1400,7 @@ bool Variant::has_method(const StringName &p_method) const {
|
|||
}
|
||||
|
||||
Vector<Variant::Type> Variant::get_method_argument_types(Variant::Type p_type, const StringName &p_method) {
|
||||
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Vector<Variant::Type>());
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
@ -1411,6 +1412,7 @@ Vector<Variant::Type> Variant::get_method_argument_types(Variant::Type p_type, c
|
|||
}
|
||||
|
||||
bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method) {
|
||||
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, false);
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
@ -1422,6 +1424,7 @@ bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method)
|
|||
}
|
||||
|
||||
Vector<StringName> Variant::get_method_argument_names(Variant::Type p_type, const StringName &p_method) {
|
||||
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Vector<StringName>());
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
@ -1433,6 +1436,7 @@ Vector<StringName> Variant::get_method_argument_names(Variant::Type p_type, cons
|
|||
}
|
||||
|
||||
Variant::Type Variant::get_method_return_type(Variant::Type p_type, const StringName &p_method, bool *r_has_return) {
|
||||
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Variant::NIL);
|
||||
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
|
||||
|
||||
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
|
||||
|
|
|
@ -282,6 +282,7 @@ String VisualScriptFunctionCall::get_text() const {
|
|||
}
|
||||
|
||||
void VisualScriptFunctionCall::set_basic_type(Variant::Type p_type) {
|
||||
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
|
||||
if (basic_type == p_type) {
|
||||
return;
|
||||
}
|
||||
|
@ -1068,6 +1069,7 @@ void VisualScriptPropertySet::_update_base_type() {
|
|||
}
|
||||
}
|
||||
void VisualScriptPropertySet::set_basic_type(Variant::Type p_type) {
|
||||
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
|
||||
if (basic_type == p_type) {
|
||||
return;
|
||||
}
|
||||
|
@ -1916,6 +1918,7 @@ VisualScriptPropertyGet::CallMode VisualScriptPropertyGet::get_call_mode() const
|
|||
}
|
||||
|
||||
void VisualScriptPropertyGet::set_basic_type(Variant::Type p_type) {
|
||||
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
|
||||
if (basic_type == p_type) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1950,6 +1950,7 @@ StringName VisualScriptBasicTypeConstant::get_basic_type_constant() const {
|
|||
}
|
||||
|
||||
void VisualScriptBasicTypeConstant::set_basic_type(Variant::Type p_which) {
|
||||
ERR_FAIL_INDEX(p_which, Variant::VARIANT_MAX);
|
||||
type = p_which;
|
||||
|
||||
List<StringName> constants;
|
||||
|
|
Loading…
Reference in a new issue