diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-06-17 15:06:13 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-06-17 15:09:07 +0200 |
| commit | ba0db95909a232e3f4d694294f077c9460ef00ce (patch) | |
| tree | 9dec7b587da17d2beac94d8003a7874d7165e9dc /editor/doc_data.cpp | |
| parent | 7cde0e4ab99e879428af38fd3f005524920c2ed4 (diff) | |
| download | redot-engine-ba0db95909a232e3f4d694294f077c9460ef00ce.tar.gz | |
DocData: Skip language-specific ClassDoc without methods/constants
Removes the useless `@C#`, `@NativeScript` and `@VisualScript` entries.
Diffstat (limited to 'editor/doc_data.cpp')
| -rw-r--r-- | editor/doc_data.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp index c52d91b03d..54acbe9559 100644 --- a/editor/doc_data.cpp +++ b/editor/doc_data.cpp @@ -662,18 +662,19 @@ void DocData::generate(bool p_basic_types) { } } - //built in script reference + // Built-in script reference. + // We only add a doc entry for languages which actually define any built-in + // methods or constants. { for (int i = 0; i < ScriptServer::get_language_count(); i++) { ScriptLanguage *lang = ScriptServer::get_language(i); String cname = "@" + lang->get_name(); - class_list[cname] = ClassDoc(); - ClassDoc &c = class_list[cname]; + ClassDoc c; c.name = cname; + // Get functions. List<MethodInfo> minfo; - lang->get_public_functions(&minfo); for (List<MethodInfo>::Element *E = minfo.front(); E; E = E->next()) { @@ -706,6 +707,7 @@ void DocData::generate(bool p_basic_types) { c.methods.push_back(md); } + // Get constants. List<Pair<String, Variant>> cinfo; lang->get_public_constants(&cinfo); @@ -715,6 +717,13 @@ void DocData::generate(bool p_basic_types) { cd.value = E->get().second; c.constants.push_back(cd); } + + // Skip adding the lang if it doesn't expose anything (e.g. C#). + if (c.methods.empty() && c.constants.empty()) { + continue; + } + + class_list[cname] = c; } } } |
