parent
7364794fed
commit
28bbcd9d45
5 changed files with 46 additions and 2 deletions
|
|
@ -133,7 +133,8 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||||
e.typ = result
|
e.typ = result
|
||||||
e.position = int(counter)
|
e.position = int(counter)
|
||||||
let symNode = newSymNode(e)
|
let symNode = newSymNode(e)
|
||||||
if optNimV1Emulation notin c.config.globalOptions and identToReplace != nil:
|
if optNimV1Emulation notin c.config.globalOptions and identToReplace != nil and
|
||||||
|
c.config.cmd != cmdDoc: # A hack to produce documentation for enum fields.
|
||||||
identToReplace[] = symNode
|
identToReplace[] = symNode
|
||||||
if e.position == 0: hasNull = true
|
if e.position == 0: hasNull = true
|
||||||
if result.sym != nil and sfExported in result.sym.flags:
|
if result.sym != nil and sfExported in result.sym.flags:
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,11 @@ function main() {
|
||||||
<li><a class="reference" href="#Foo"
|
<li><a class="reference" href="#Foo"
|
||||||
title="Foo = enum
|
title="Foo = enum
|
||||||
enumValueA2">Foo</a></li>
|
enumValueA2">Foo</a></li>
|
||||||
|
<li><a class="reference" href="#Shapes"
|
||||||
|
title="Shapes = enum
|
||||||
|
Circle, ## A circle
|
||||||
|
Triangle, ## A three-sided shape
|
||||||
|
Rectangle ## A four-sided shape">Shapes</a></li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -406,6 +411,16 @@ The enum B.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<a id="Shapes"></a>
|
||||||
|
<dt><pre><a href="testproject.html#Shapes"><span class="Identifier">Shapes</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
|
||||||
|
<span class="Identifier">Circle</span><span class="Other">,</span> <span class="Comment">## A circle</span>
|
||||||
|
<span class="Identifier">Triangle</span><span class="Other">,</span> <span class="Comment">## A three-sided shape</span>
|
||||||
|
<span class="Identifier">Rectangle</span> <span class="Comment">## A four-sided shape</span></pre></dt>
|
||||||
|
<dd>
|
||||||
|
|
||||||
|
Some shapes.
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
</dl></div>
|
</dl></div>
|
||||||
|
|
|
||||||
|
|
@ -54,3 +54,7 @@ asyncFun1 testproject.html#asyncFun1 testproject: asyncFun1(): Future[int]
|
||||||
asyncFun2 testproject.html#asyncFun2 testproject: asyncFun2(): owned(Future[void])
|
asyncFun2 testproject.html#asyncFun2 testproject: asyncFun2(): owned(Future[void])
|
||||||
asyncFun3 testproject.html#asyncFun3 testproject: asyncFun3(): owned(Future[void])
|
asyncFun3 testproject.html#asyncFun3 testproject: asyncFun3(): owned(Future[void])
|
||||||
testNimDocTrailingExample testproject.html#testNimDocTrailingExample.t testproject: testNimDocTrailingExample()
|
testNimDocTrailingExample testproject.html#testNimDocTrailingExample.t testproject: testNimDocTrailingExample()
|
||||||
|
Circle testproject.html#Circle Shapes.Circle
|
||||||
|
Triangle testproject.html#Triangle Shapes.Triangle
|
||||||
|
Rectangle testproject.html#Rectangle Shapes.Rectangle
|
||||||
|
Shapes testproject.html#Shapes testproject: Shapes
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,10 @@ function main() {
|
||||||
<li><a class="reference external"
|
<li><a class="reference external"
|
||||||
data-doc-search-tag="testproject: C_D" href="testproject.html#C_D">testproject: C_D</a></li>
|
data-doc-search-tag="testproject: C_D" href="testproject.html#C_D">testproject: C_D</a></li>
|
||||||
</ul></dd>
|
</ul></dd>
|
||||||
|
<dt><a name="Circle" href="#Circle"><span>Circle:</span></a></dt><dd><ul class="simple">
|
||||||
|
<li><a class="reference external"
|
||||||
|
data-doc-search-tag="Shapes.Circle" href="testproject.html#Circle">Shapes.Circle</a></li>
|
||||||
|
</ul></dd>
|
||||||
<dt><a name="c_nonexistant" href="#c_nonexistant"><span>c_nonexistant:</span></a></dt><dd><ul class="simple">
|
<dt><a name="c_nonexistant" href="#c_nonexistant"><span>c_nonexistant:</span></a></dt><dd><ul class="simple">
|
||||||
<li><a class="reference external"
|
<li><a class="reference external"
|
||||||
data-doc-search-tag="testproject: c_nonexistant(frmt: cstring): cint" href="testproject.html#c_nonexistant%2Ccstring">testproject: c_nonexistant(frmt: cstring): cint</a></li>
|
data-doc-search-tag="testproject: c_nonexistant(frmt: cstring): cint" href="testproject.html#c_nonexistant%2Ccstring">testproject: c_nonexistant(frmt: cstring): cint</a></li>
|
||||||
|
|
@ -220,6 +224,14 @@ function main() {
|
||||||
<li><a class="reference external"
|
<li><a class="reference external"
|
||||||
data-doc-search-tag="testproject: p1()" href="testproject.html#p1">testproject: p1()</a></li>
|
data-doc-search-tag="testproject: p1()" href="testproject.html#p1">testproject: p1()</a></li>
|
||||||
</ul></dd>
|
</ul></dd>
|
||||||
|
<dt><a name="Rectangle" href="#Rectangle"><span>Rectangle:</span></a></dt><dd><ul class="simple">
|
||||||
|
<li><a class="reference external"
|
||||||
|
data-doc-search-tag="Shapes.Rectangle" href="testproject.html#Rectangle">Shapes.Rectangle</a></li>
|
||||||
|
</ul></dd>
|
||||||
|
<dt><a name="Shapes" href="#Shapes"><span>Shapes:</span></a></dt><dd><ul class="simple">
|
||||||
|
<li><a class="reference external"
|
||||||
|
data-doc-search-tag="testproject: Shapes" href="testproject.html#Shapes">testproject: Shapes</a></li>
|
||||||
|
</ul></dd>
|
||||||
<dt><a name="someFunc" href="#someFunc"><span>someFunc:</span></a></dt><dd><ul class="simple">
|
<dt><a name="someFunc" href="#someFunc"><span>someFunc:</span></a></dt><dd><ul class="simple">
|
||||||
<li><a class="reference external"
|
<li><a class="reference external"
|
||||||
data-doc-search-tag="testproject: someFunc()" href="testproject.html#someFunc">testproject: someFunc()</a></li>
|
data-doc-search-tag="testproject: someFunc()" href="testproject.html#someFunc">testproject: someFunc()</a></li>
|
||||||
|
|
@ -236,6 +248,10 @@ function main() {
|
||||||
<li><a class="reference external"
|
<li><a class="reference external"
|
||||||
data-doc-search-tag="testproject: testNimDocTrailingExample()" href="testproject.html#testNimDocTrailingExample.t">testproject: testNimDocTrailingExample()</a></li>
|
data-doc-search-tag="testproject: testNimDocTrailingExample()" href="testproject.html#testNimDocTrailingExample.t">testproject: testNimDocTrailingExample()</a></li>
|
||||||
</ul></dd>
|
</ul></dd>
|
||||||
|
<dt><a name="Triangle" href="#Triangle"><span>Triangle:</span></a></dt><dd><ul class="simple">
|
||||||
|
<li><a class="reference external"
|
||||||
|
data-doc-search-tag="Shapes.Triangle" href="testproject.html#Triangle">Shapes.Triangle</a></li>
|
||||||
|
</ul></dd>
|
||||||
<dt><a name="tripleStrLitTest" href="#tripleStrLitTest"><span>tripleStrLitTest:</span></a></dt><dd><ul class="simple">
|
<dt><a name="tripleStrLitTest" href="#tripleStrLitTest"><span>tripleStrLitTest:</span></a></dt><dd><ul class="simple">
|
||||||
<li><a class="reference external"
|
<li><a class="reference external"
|
||||||
data-doc-search-tag="testproject: tripleStrLitTest()" href="testproject.html#tripleStrLitTest">testproject: tripleStrLitTest()</a></li>
|
data-doc-search-tag="testproject: tripleStrLitTest()" href="testproject.html#tripleStrLitTest">testproject: tripleStrLitTest()</a></li>
|
||||||
|
|
|
||||||
|
|
@ -363,4 +363,12 @@ when true:
|
||||||
# where runnableExamples would not show if there was not at least 2 "\n" after
|
# where runnableExamples would not show if there was not at least 2 "\n" after
|
||||||
# the last character of runnableExamples
|
# the last character of runnableExamples
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
discard 2
|
discard 2
|
||||||
|
|
||||||
|
when true: # issue #15702
|
||||||
|
type
|
||||||
|
Shapes* = enum
|
||||||
|
## Some shapes.
|
||||||
|
Circle, ## A circle
|
||||||
|
Triangle, ## A three-sided shape
|
||||||
|
Rectangle ## A four-sided shape
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue