diff options
author | Yuri Sizov <yuris@humnom.net> | 2022-07-04 18:56:34 +0300 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2022-07-04 20:21:39 +0300 |
commit | a9098e6147d294378bf7c62fb10c83a0d2670b33 (patch) | |
tree | b7d87f569684700387592ca9679d16d82a0b5451 /core | |
parent | b4644e283556b499a22dada2db5cff12290440ca (diff) |
Add support for documenting built-in annotations
Diffstat (limited to 'core')
-rw-r--r-- | core/doc_data.h | 1 | ||||
-rw-r--r-- | core/object/script_language.h | 2 | ||||
-rw-r--r-- | core/object/script_language_extension.cpp | 2 | ||||
-rw-r--r-- | core/object/script_language_extension.h | 9 |
4 files changed, 14 insertions, 0 deletions
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<ConstantDoc> constants; HashMap<String, String> enums; Vector<PropertyDoc> properties; + Vector<MethodDoc> annotations; Vector<ThemeItemDoc> 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<String> *p_extensions) const = 0; virtual void get_public_functions(List<MethodInfo> *p_functions) const = 0; virtual void get_public_constants(List<Pair<String, Variant>> *p_constants) const = 0; + virtual void get_public_annotations(List<MethodInfo> *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<String, Variant>(d["name"], d["value"])); } } + GDVIRTUAL0RC(TypedArray<Dictionary>, _get_public_annotations) + virtual void get_public_annotations(List<MethodInfo> *p_annotations) const override { + TypedArray<Dictionary> 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) |