diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 5eaaed12041df..5392f1edf7c3a 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -630,8 +630,12 @@ proc genDeprecationMsg(d: PDoc, n: PNode): Rope = else: doAssert false -proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) = - if not isVisible(d, nameNode): return +type DocFlags = enum + kDefault + kForceExport + +proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind, docFlags: DocFlags) = + if (docFlags != kForceExport) and not isVisible(d, nameNode): return let name = getName(d, nameNode) nameRope = name.rope @@ -847,7 +851,9 @@ proc documentRaises*(cache: IdentCache; n: PNode) = if p4 != nil: n[pragmasPos].add p4 if p5 != nil: n[pragmasPos].add p5 -proc generateDoc*(d: PDoc, n, orig: PNode) = +proc generateDoc*(d: PDoc, n, orig: PNode, docFlags: DocFlags = kDefault) = + template genItemAux(skind) = + genItem(d, n, n[namePos], skind, docFlags) case n.kind of nkPragma: let pragmaNode = findPragma(n, wDeprecated) @@ -855,27 +861,27 @@ proc generateDoc*(d: PDoc, n, orig: PNode) = of nkCommentStmt: d.modDesc.add(genComment(d, n)) of nkProcDef: when useEffectSystem: documentRaises(d.cache, n) - genItem(d, n, n[namePos], skProc) + genItemAux(skProc) of nkFuncDef: when useEffectSystem: documentRaises(d.cache, n) - genItem(d, n, n[namePos], skFunc) + genItemAux(skFunc) of nkMethodDef: when useEffectSystem: documentRaises(d.cache, n) - genItem(d, n, n[namePos], skMethod) + genItemAux(skMethod) of nkIteratorDef: when useEffectSystem: documentRaises(d.cache, n) - genItem(d, n, n[namePos], skIterator) - of nkMacroDef: genItem(d, n, n[namePos], skMacro) - of nkTemplateDef: genItem(d, n, n[namePos], skTemplate) + genItemAux(skIterator) + of nkMacroDef: genItemAux(skMacro) + of nkTemplateDef: genItemAux(skTemplate) of nkConverterDef: when useEffectSystem: documentRaises(d.cache, n) - genItem(d, n, n[namePos], skConverter) + genItemAux(skConverter) of nkTypeSection, nkVarSection, nkLetSection, nkConstSection: for i in 0..