summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-24 23:26:30 +0200
committerGitHub <noreply@github.com>2022-07-24 23:26:30 +0200
commitb7a47bfc09cc581e27fec051b71f1dfc6c68b7ad (patch)
tree48f4a7d42a7ec587a5a5043eab6d1d0081ffc796
parent9233a6be041ffe6440f6cffc5c7c5d4d450cd065 (diff)
parent5d49df8d97f4e7c0cafae80115f784f1d0e97044 (diff)
Merge pull request #63098 from Xwdit/fix_qualifiers_script_doc
-rw-r--r--core/doc_data.cpp27
-rw-r--r--editor/doc_tools.cpp48
-rw-r--r--modules/gdscript/gdscript.cpp5
3 files changed, 32 insertions, 48 deletions
diff --git a/core/doc_data.cpp b/core/doc_data.cpp
index 89e7a8dc71..df86cd1dc2 100644
--- a/core/doc_data.cpp
+++ b/core/doc_data.cpp
@@ -115,6 +115,31 @@ void DocData::method_doc_from_methodinfo(DocData::MethodDoc &p_method, const Met
p_method.name = p_methodinfo.name;
p_method.description = p_desc;
+ if (p_methodinfo.flags & METHOD_FLAG_VIRTUAL) {
+ p_method.qualifiers = "virtual";
+ }
+
+ if (p_methodinfo.flags & METHOD_FLAG_CONST) {
+ if (!p_method.qualifiers.is_empty()) {
+ p_method.qualifiers += " ";
+ }
+ p_method.qualifiers += "const";
+ }
+
+ if (p_methodinfo.flags & METHOD_FLAG_VARARG) {
+ if (!p_method.qualifiers.is_empty()) {
+ p_method.qualifiers += " ";
+ }
+ p_method.qualifiers += "vararg";
+ }
+
+ if (p_methodinfo.flags & METHOD_FLAG_STATIC) {
+ if (!p_method.qualifiers.is_empty()) {
+ p_method.qualifiers += " ";
+ }
+ p_method.qualifiers += "static";
+ }
+
return_doc_from_retinfo(p_method, p_methodinfo.return_val);
for (int i = 0; i < p_methodinfo.arguments.size(); i++) {
@@ -123,7 +148,7 @@ void DocData::method_doc_from_methodinfo(DocData::MethodDoc &p_method, const Met
int default_arg_index = i - (p_methodinfo.arguments.size() - p_methodinfo.default_arguments.size());
if (default_arg_index >= 0) {
Variant default_arg = p_methodinfo.default_arguments[default_arg_index];
- argument.default_value = default_arg.get_construct_string();
+ argument.default_value = default_arg.get_construct_string().replace("\n", "");
}
p_method.arguments.push_back(argument);
}
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index a6c7970264..773fcc5017 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -498,53 +498,7 @@ void DocTools::generate(bool p_basic_types) {
}
DocData::MethodDoc method;
-
- method.name = E.name;
-
- if (E.flags & METHOD_FLAG_VIRTUAL) {
- method.qualifiers = "virtual";
- }
-
- if (E.flags & METHOD_FLAG_CONST) {
- if (!method.qualifiers.is_empty()) {
- method.qualifiers += " ";
- }
- method.qualifiers += "const";
- }
-
- if (E.flags & METHOD_FLAG_VARARG) {
- if (!method.qualifiers.is_empty()) {
- method.qualifiers += " ";
- }
- method.qualifiers += "vararg";
- }
-
- if (E.flags & METHOD_FLAG_STATIC) {
- if (!method.qualifiers.is_empty()) {
- method.qualifiers += " ";
- }
- method.qualifiers += "static";
- }
-
- for (int i = -1; i < E.arguments.size(); i++) {
- if (i == -1) {
-#ifdef DEBUG_METHODS_ENABLED
- DocData::return_doc_from_retinfo(method, E.return_val);
-#endif
- } else {
- const PropertyInfo &arginfo = E.arguments[i];
- DocData::ArgumentDoc argument;
- DocData::argument_doc_from_arginfo(argument, arginfo);
-
- int darg_idx = i - (E.arguments.size() - E.default_arguments.size());
- if (darg_idx >= 0) {
- Variant default_arg = E.default_arguments[darg_idx];
- argument.default_value = default_arg.get_construct_string().replace("\n", " ");
- }
-
- method.arguments.push_back(argument);
- }
- }
+ DocData::method_doc_from_methodinfo(method, E, "");
Vector<Error> errs = ClassDB::get_method_error_return_values(name, E.name);
if (errs.size()) {
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 964c1133ff..a34bf6ef82 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -278,6 +278,11 @@ void GDScript::_get_script_method_list(List<MethodInfo> *r_list, bool p_include_
GDScriptFunction *func = E.value;
MethodInfo mi;
mi.name = E.key;
+
+ if (func->is_static()) {
+ mi.flags |= METHOD_FLAG_STATIC;
+ }
+
for (int i = 0; i < func->get_argument_count(); i++) {
PropertyInfo arginfo = func->get_argument_type(i);
#ifdef TOOLS_ENABLED