diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-doc-ast.cpp | 10 | ||||
| -rw-r--r-- | source/slang/slang-doc-ast.h | 4 | ||||
| -rw-r--r-- | source/slang/slang-doc-markdown-writer.cpp | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/source/slang/slang-doc-ast.cpp b/source/slang/slang-doc-ast.cpp index 172f31b32..4d35f32be 100644 --- a/source/slang/slang-doc-ast.cpp +++ b/source/slang/slang-doc-ast.cpp @@ -3,6 +3,7 @@ #include "../core/slang-string-util.h" +#include "slang/slang-ast-support-types.h" //#include "slang-ast-builder.h" //#include "slang-ast-print.h" @@ -47,9 +48,14 @@ namespace Slang { } } +bool shouldDocumentDecl(Decl* decl) +{ + return !getText(decl->getName()).startsWith("$__syn") && !decl->hasModifier<SynthesizedModifier>(); +} + static void _addDeclRec(Decl* decl, List<Decl*>& outDecls) { - if (decl == nullptr) + if (decl == nullptr || !shouldDocumentDecl(decl)) { return; } @@ -109,7 +115,7 @@ SlangResult ASTMarkupUtil::extract(ModuleDecl* moduleDecl, SourceManager* source item.searchStyle = getSearchStyle(decl); // Don't generate documentation for synthesized members. - if (getText(decl->getName()).startsWith("$__syn")) + if (!shouldDocumentDecl(decl)) item.searchStyle = DocMarkupExtractor::SearchStyle::None; } diff --git a/source/slang/slang-doc-ast.h b/source/slang/slang-doc-ast.h index 25c39d9d3..a0d5367af 100644 --- a/source/slang/slang-doc-ast.h +++ b/source/slang/slang-doc-ast.h @@ -8,6 +8,8 @@ #include "slang-ast-all.h" +#include "slang-syntax.h" + namespace Slang { /* Holds the documentation markup that is associated with each node (typically a decl) from a module */ @@ -87,6 +89,8 @@ struct ASTMarkupUtil static SlangResult extract(ModuleDecl* moduleDecl, SourceManager* sourceManager, DiagnosticSink* sink, ASTMarkup* outMarkup, bool searchOrindaryComments = false); }; +bool shouldDocumentDecl(Decl* decl); + } // namespace Slang #endif diff --git a/source/slang/slang-doc-markdown-writer.cpp b/source/slang/slang-doc-markdown-writer.cpp index f29574180..c9dd6d9c8 100644 --- a/source/slang/slang-doc-markdown-writer.cpp +++ b/source/slang/slang-doc-markdown-writer.cpp @@ -1070,6 +1070,8 @@ void DocMarkdownWriter::writeAggType(const ASTMarkup::Entry& entry, AggTypeDeclB List<Decl*> uniqueMethods; for (const auto& [_, decl] : memberDict) { + if (!shouldDocumentDecl(decl)) + continue; CallableDecl* callableDecl = as<CallableDecl>(decl); if (callableDecl && isVisible(callableDecl)) { |
