summaryrefslogtreecommitdiffstats
path: root/core/extension/extension_api_dump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/extension/extension_api_dump.cpp')
-rw-r--r--core/extension/extension_api_dump.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp
index d7fba74365..848b6f3886 100644
--- a/core/extension/extension_api_dump.cpp
+++ b/core/extension/extension_api_dump.cpp
@@ -1018,26 +1018,34 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
d2["is_virtual"] = true;
// virtual functions have no hash since no MethodBind is involved
bool has_return = mi.return_val.type != Variant::NIL || (mi.return_val.usage & PROPERTY_USAGE_NIL_IS_VARIANT);
- Array arguments;
- for (int i = (has_return ? -1 : 0); i < mi.arguments.size(); i++) {
- PropertyInfo pinfo = i == -1 ? mi.return_val : mi.arguments[i];
+ if (has_return) {
+ PropertyInfo pinfo = mi.return_val;
Dictionary d3;
- if (i >= 0) {
- d3["name"] = pinfo.name;
+ d3["type"] = get_property_info_type_name(pinfo);
+
+ if (mi.get_argument_meta(-1) > 0) {
+ d3["meta"] = get_type_meta_name((GodotTypeInfo::Metadata)mi.get_argument_meta(-1));
}
+ d2["return_value"] = d3;
+ }
+
+ Array arguments;
+ int i = 0;
+ for (List<PropertyInfo>::ConstIterator itr = mi.arguments.begin(); itr != mi.arguments.end(); ++itr, ++i) {
+ const PropertyInfo &pinfo = *itr;
+ Dictionary d3;
+
+ d3["name"] = pinfo.name;
+
d3["type"] = get_property_info_type_name(pinfo);
if (mi.get_argument_meta(i) > 0) {
d3["meta"] = get_type_meta_name((GodotTypeInfo::Metadata)mi.get_argument_meta(i));
}
- if (i == -1) {
- d2["return_value"] = d3;
- } else {
- arguments.push_back(d3);
- }
+ arguments.push_back(d3);
}
if (arguments.size()) {
@@ -1151,10 +1159,11 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
Array arguments;
- for (int i = 0; i < F.arguments.size(); i++) {
+ int i = 0;
+ for (List<PropertyInfo>::ConstIterator itr = F.arguments.begin(); itr != F.arguments.end(); ++itr, ++i) {
Dictionary d3;
- d3["name"] = F.arguments[i].name;
- d3["type"] = get_property_info_type_name(F.arguments[i]);
+ d3["name"] = itr->name;
+ d3["type"] = get_property_info_type_name(*itr);
if (F.get_argument_meta(i) > 0) {
d3["meta"] = get_type_meta_name((GodotTypeInfo::Metadata)F.get_argument_meta(i));
}
@@ -1192,7 +1201,7 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
if (F.name.begins_with("_")) {
continue; //hidden property
}
- if (F.name.find("/") >= 0) {
+ if (F.name.contains("/")) {
// Ignore properties with '/' (slash) in the name. These are only meant for use in the inspector.
continue;
}