diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-doc-markdown-writer.cpp | 37 | ||||
| -rw-r--r-- | source/slang/slang-doc-markdown-writer.h | 1 |
2 files changed, 38 insertions, 0 deletions
diff --git a/source/slang/slang-doc-markdown-writer.cpp b/source/slang/slang-doc-markdown-writer.cpp index 2a9a83361..2a215d6bd 100644 --- a/source/slang/slang-doc-markdown-writer.cpp +++ b/source/slang/slang-doc-markdown-writer.cpp @@ -356,6 +356,35 @@ String DocMarkdownWriter::_getName(InheritanceDecl* decl) return buf.produceString(); } +String DocMarkdownWriter::_getName(ExtensionDecl* extDecl) +{ + StringBuilder buf; + buf.clear(); + + if (auto declRef = isDeclRefTypeOf<Decl>(extDecl->targetType)) + { + buf << "extension " << _getName(declRef.getDecl()).getUnownedSlice(); + + List<InheritanceDecl*> inheritanceDecls; + _getDecls(extDecl, inheritanceDecls); + + const Index count = inheritanceDecls.getCount(); + if (count) + { + buf << " : "; + + List<String> baseNames; + for (Index i = 0; i < count; ++i) + { + baseNames.add(_getName(inheritanceDecls[i])); + } + StringUtil::join(baseNames, UnownedStringSlice(", "), buf); + } + } + + return buf.produceString(); +} + DocMarkdownWriter::NameAndText DocMarkdownWriter::_getNameAndText( ASTMarkup::Entry* entry, Decl* decl) @@ -2973,6 +3002,14 @@ DocumentPage* DocMarkdownWriter::getPage(Decl* decl) page->path = path; page->shortName = _getName(decl); page->decl = decl; + if (auto extDecl = as<ExtensionDecl>(decl)) + { + page->shortName = _getName(extDecl); + if (auto declRef = isDeclRefTypeOf<Decl>(extDecl->targetType)) + { + page->decl = declRef.getDecl(); + } + } m_output[path] = page; // If parent page exists, add this page to it's children diff --git a/source/slang/slang-doc-markdown-writer.h b/source/slang/slang-doc-markdown-writer.h index 36d851e61..f4ca4de7f 100644 --- a/source/slang/slang-doc-markdown-writer.h +++ b/source/slang/slang-doc-markdown-writer.h @@ -214,6 +214,7 @@ struct DocMarkdownWriter String _getFullName(Decl* decl); String _getDocFilePath(Decl* decl); String _getName(InheritanceDecl* decl); + String _getName(ExtensionDecl* extDecl); NameAndText _getNameAndText(ASTMarkup::Entry* entry, Decl* decl); NameAndText _getNameAndText(Decl* decl); |
