diff options
author | Jake Leahy <jake@leahy.dev> | 2023-07-17 03:46:18 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-16 19:46:18 +0200 |
commit | 17915d93bfb50aaff6c4bf77fe25707705e557c8 (patch) | |
tree | 733c75bfc3aca4f8b412e6940abc3b8eb30f744c /nimdoc/testproject | |
parent | 50d435cd3941f6c7f71a2e2b91cfa40a5a4efcb9 (diff) | |
download | Nim-17915d93bfb50aaff6c4bf77fe25707705e557c8.tar.gz |
Fix non-toplevel fields in objects not getting rendered (#22266)
* Add example object into testproject The proc is there to check the case of an identDef being inside an identDef (We do want to render those even if they are not exported) * Add `inside` set to `TSrcGen` which allows us to see what context we are in This is done instead of adding another inXyz bool parameter We then use this to know if we are inside an object when rendering an nkIdentDefs (To know if we need to skip rendering it) * Update test files
Diffstat (limited to 'nimdoc/testproject')
-rw-r--r-- | nimdoc/testproject/expected/testproject.html | 23 | ||||
-rw-r--r-- | nimdoc/testproject/expected/testproject.idx | 1 | ||||
-rw-r--r-- | nimdoc/testproject/expected/theindex.html | 4 | ||||
-rw-r--r-- | nimdoc/testproject/testproject.nim | 8 |
4 files changed, 35 insertions, 1 deletions
diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html index a5c9b6af2..78a730e59 100644 --- a/nimdoc/testproject/expected/testproject.html +++ b/nimdoc/testproject/expected/testproject.html @@ -56,6 +56,12 @@ <ul class="simple simple-toc-section"> <li><a class="reference" href="#A" title="A {.inject.} = enum aA">A</a></li> +<li><a class="reference" href="#AnotherObject" title="AnotherObject = object + case x*: bool + of true: + y*: proc (x: string) + + of false:">AnotherObject</a></li> <li><a class="reference" href="#B" title="B {.inject.} = enum bB">B</a></li> <li><a class="reference" href="#Foo" title="Foo = enum @@ -370,6 +376,21 @@ </dd> </div> +<div id="AnotherObject"> + <dt><pre><a href="testproject.html#AnotherObject"><span class="Identifier">AnotherObject</span></a> <span class="Other">=</span> <span class="Keyword">object</span> + <span class="Keyword">case</span> <span class="Identifier">x</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span> + <span class="Keyword">of</span> <span class="Identifier">true</span><span class="Other">:</span> + <span class="Identifier">y</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> + + <span class="Keyword">of</span> <span class="Identifier">false</span><span class="Other">:</span> + + </pre></dt> + <dd> + + + + </dd> +</div> <div id="B"> <dt><pre><a href="testproject.html#B"><span class="Identifier">B</span></a> {.<span class="Identifier">inject</span>.} <span class="Other">=</span> <span class="Keyword">enum</span> <span class="Identifier">bB</span></pre></dt> @@ -424,7 +445,7 @@ <div id="T19396"> <dt><pre><a href="testproject.html#T19396"><span class="Identifier">T19396</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Identifier">a</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span> -</pre></dt> + </pre></dt> <dd> diff --git a/nimdoc/testproject/expected/testproject.idx b/nimdoc/testproject/expected/testproject.idx index c29223a83..ac9bbb2ce 100644 --- a/nimdoc/testproject/expected/testproject.idx +++ b/nimdoc/testproject/expected/testproject.idx @@ -66,5 +66,6 @@ nim anything testproject.html#anything proc anything() 387 nim T19396 testproject.html#T19396 object T19396 392 nim somePragma testproject.html#somePragma.t template somePragma() 396 nim MyObject testproject.html#MyObject object MyObject 400 +nim AnotherObject testproject.html#AnotherObject object AnotherObject 405 nimgrp bar testproject.html#bar-procs-all proc 31 nimgrp baz testproject.html#baz-procs-all proc 34 diff --git a/nimdoc/testproject/expected/theindex.html b/nimdoc/testproject/expected/theindex.html index 24e3cff1c..70916f7e0 100644 --- a/nimdoc/testproject/expected/theindex.html +++ b/nimdoc/testproject/expected/theindex.html @@ -52,6 +52,10 @@ <li><a class="reference external" data-doc-search-tag="utils: template aEnum(): untyped" href="subdir/subdir_b/utils.html#aEnum.t">utils: template aEnum(): untyped</a></li> </ul></dd> +<dt><a name="AnotherObject" href="#AnotherObject"><span>AnotherObject:</span></a></dt><dd><ul class="simple"> +<li><a class="reference external" + data-doc-search-tag="testproject: object AnotherObject" href="testproject.html#AnotherObject">testproject: object AnotherObject</a></li> + </ul></dd> <dt><a name="anything" href="#anything"><span>anything:</span></a></dt><dd><ul class="simple"> <li><a class="reference external" data-doc-search-tag="testproject: proc anything()" href="testproject.html#anything">testproject: proc anything()</a></li> diff --git a/nimdoc/testproject/testproject.nim b/nimdoc/testproject/testproject.nim index d08a12544..d2d3fef3f 100644 --- a/nimdoc/testproject/testproject.nim +++ b/nimdoc/testproject/testproject.nim @@ -400,3 +400,11 @@ type # bug #21483 MyObject* = object someString*: string ## This is a string annotated* {.somePragma.}: string ## This is an annotated string + +type + AnotherObject* = object + case x*: bool + of true: + y*: proc (x: string) + of false: + hidden: string |