DocData and type hints fixes

- Makes vararg methods automatically use PROPERTY_USAGE_NIL_IS_VARIANT on return types
- Completely removes the ":type" suffix for method names. Virtual methods must use the MethodInfo constructors that takes Variant::Type or PropertyHint as the first parameter for the return type (with CLASS_INFO as a helper to get the PropertyInfo). Parameters must use PROPERTY_HINT_RESOURCE_TYPE and hint string.
- PROPERTY_USAGE_NIL_IS_VARIANT is no longer needed for parameters, because parameters cannot be void.
- Adds missing PROPERTY_USAGE_NIL_IS_VARIANT to virtual and built-in methods that return Variant.
This commit is contained in:
Ignacio Etcheverry
2017-08-29 07:15:46 +02:00
parent 909c9e0ba0
commit c16d00591b
15 changed files with 184 additions and 113 deletions

View File

@ -1620,8 +1620,9 @@ MethodInfo GDFunctions::get_info(Function p_func) {
} break;
case STR_TO_VAR: {
MethodInfo mi("str2var:Variant", PropertyInfo(Variant::STRING, "string"));
MethodInfo mi(Variant::NIL, "str2var", PropertyInfo(Variant::STRING, "string"));
mi.return_val.type = Variant::NIL;
mi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
return mi;
} break;
case VAR_TO_BYTES: {
@ -1632,8 +1633,9 @@ MethodInfo GDFunctions::get_info(Function p_func) {
} break;
case BYTES_TO_VAR: {
MethodInfo mi("bytes2var:Variant", PropertyInfo(Variant::POOL_BYTE_ARRAY, "bytes"));
MethodInfo mi(Variant::NIL, "bytes2var", PropertyInfo(Variant::POOL_BYTE_ARRAY, "bytes"));
mi.return_val.type = Variant::NIL;
mi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
return mi;
} break;
case GEN_RANGE: {
@ -1663,14 +1665,15 @@ MethodInfo GDFunctions::get_info(Function p_func) {
} break;
case VALIDATE_JSON: {
MethodInfo mi("validate_json:Variant", PropertyInfo(Variant::STRING, "json"));
MethodInfo mi("validate_json", PropertyInfo(Variant::STRING, "json"));
mi.return_val.type = Variant::STRING;
return mi;
} break;
case PARSE_JSON: {
MethodInfo mi("parse_json:Variant", PropertyInfo(Variant::STRING, "json"));
MethodInfo mi(Variant::NIL, "parse_json", PropertyInfo(Variant::STRING, "json"));
mi.return_val.type = Variant::NIL;
mi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
return mi;
} break;
case TO_JSON: {