Skip to content

Commit

Permalink
fix spurious indent and newlines in rendering of nkRecList
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Dec 23, 2023
1 parent c0acf3c commit ec75ea4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 3 additions & 3 deletions compiler/renderer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1531,17 +1531,17 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext, fromStmtList = false) =
gsub(g, n[0])
gsub(g, n[1])
gcoms(g)
indentNL(g)
gsub(g, n[2])
dedent(g)
putNL(g)
else:
put(g, tkObject, "object")
of nkRecList:
indentNL(g)
for i in 0..<n.len:
optNL(g)
gsub(g, n[i], c)
gcoms(g)
dedent(g)
putNL(g)
of nkOfInherit:
putWithSpace(g, tkOf, "of")
gsub(g, n, 0)
Expand Down
7 changes: 2 additions & 5 deletions nimdoc/testproject/expected/testproject.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ <h1 class="title">testproject</h1>
<li><a class="reference" href="#AnotherObject" title="AnotherObject = object
case x*: bool
of true:
y*: proc (x: string)
y*: proc (x: string)
of false:">AnotherObject</a></li>
<li><a class="reference" href="#B" title="B {.inject.} = enum
bB">B</a></li>
Expand Down Expand Up @@ -380,10 +379,8 @@ <h1><a class="toc-backref" href="#7">Types</a></h1>
<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="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>

Expand Down

0 comments on commit ec75ea4

Please sign in to comment.