From a9098e6147d294378bf7c62fb10c83a0d2670b33 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Mon, 4 Jul 2022 18:56:34 +0300 Subject: Add support for documenting built-in annotations --- core/doc_data.h | 1 + core/object/script_language.h | 2 ++ core/object/script_language_extension.cpp | 2 ++ core/object/script_language_extension.h | 9 +++++++++ 4 files changed, 14 insertions(+) (limited to 'core') diff --git a/core/doc_data.h b/core/doc_data.h index af20b717d7..75c155c4bf 100644 --- a/core/doc_data.h +++ b/core/doc_data.h @@ -163,6 +163,7 @@ public: Vector constants; HashMap enums; Vector properties; + Vector annotations; Vector theme_properties; bool is_script_doc = false; String script_path; diff --git a/core/object/script_language.h b/core/object/script_language.h index 776a9bfaab..686ab5b8d3 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -350,6 +350,7 @@ public: LOOKUP_RESULT_CLASS_SIGNAL, LOOKUP_RESULT_CLASS_ENUM, LOOKUP_RESULT_CLASS_TBD_GLOBALSCOPE, + LOOKUP_RESULT_CLASS_ANNOTATION, LOOKUP_RESULT_MAX }; @@ -402,6 +403,7 @@ public: virtual void get_recognized_extensions(List *p_extensions) const = 0; virtual void get_public_functions(List *p_functions) const = 0; virtual void get_public_constants(List> *p_constants) const = 0; + virtual void get_public_annotations(List *p_annotations) const = 0; struct ProfilingInfo { StringName signature; diff --git a/core/object/script_language_extension.cpp b/core/object/script_language_extension.cpp index 5af79bbea3..ab8dd6d1ee 100644 --- a/core/object/script_language_extension.cpp +++ b/core/object/script_language_extension.cpp @@ -134,6 +134,7 @@ void ScriptLanguageExtension::_bind_methods() { GDVIRTUAL_BIND(_get_recognized_extensions); GDVIRTUAL_BIND(_get_public_functions); GDVIRTUAL_BIND(_get_public_constants); + GDVIRTUAL_BIND(_get_public_annotations); GDVIRTUAL_BIND(_profiling_start); GDVIRTUAL_BIND(_profiling_stop); @@ -160,6 +161,7 @@ void ScriptLanguageExtension::_bind_methods() { BIND_ENUM_CONSTANT(LOOKUP_RESULT_CLASS_SIGNAL); BIND_ENUM_CONSTANT(LOOKUP_RESULT_CLASS_ENUM); BIND_ENUM_CONSTANT(LOOKUP_RESULT_CLASS_TBD_GLOBALSCOPE); + BIND_ENUM_CONSTANT(LOOKUP_RESULT_CLASS_ANNOTATION); BIND_ENUM_CONSTANT(LOOKUP_RESULT_MAX); BIND_ENUM_CONSTANT(LOCATION_LOCAL); diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h index 7eea48370e..2c53139ec2 100644 --- a/core/object/script_language_extension.h +++ b/core/object/script_language_extension.h @@ -580,6 +580,15 @@ public: p_constants->push_back(Pair(d["name"], d["value"])); } } + GDVIRTUAL0RC(TypedArray, _get_public_annotations) + virtual void get_public_annotations(List *p_annotations) const override { + TypedArray ret; + GDVIRTUAL_REQUIRED_CALL(_get_public_annotations, ret); + for (int i = 0; i < ret.size(); i++) { + MethodInfo mi = MethodInfo::from_dict(ret[i]); + p_annotations->push_back(mi); + } + } EXBIND0(profiling_start) EXBIND0(profiling_stop) -- cgit v1.2.3