mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 11:54:11 +00:00
Revert #7964
Somehow the test case doesn't crash anymore and the regression in the doc generation is fixed. Fixes #9019
This commit is contained in:
@@ -495,12 +495,8 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
|
||||
# keep documentation information:
|
||||
b.comment = a.comment
|
||||
addSon(b, newSymNode(v))
|
||||
# keep type desc for doc generator, but only if the user explicitly
|
||||
# added it
|
||||
if a.sons[length-2].kind != nkEmpty:
|
||||
addSon(b, newNodeIT(nkType, a.info, typ))
|
||||
else:
|
||||
addSon(b, a.sons[length-2])
|
||||
# keep type desc for doc generator
|
||||
addSon(b, a.sons[length-2])
|
||||
addSon(b, copyTree(def))
|
||||
addToVarSection(c, result, n, b)
|
||||
else:
|
||||
|
||||
@@ -935,12 +935,11 @@ proc transform(c: PTransf, n: PNode): PTransNode =
|
||||
else:
|
||||
result = transformSons(c, n)
|
||||
of nkIdentDefs, nkConstDef:
|
||||
when true:
|
||||
result = transformSons(c, n)
|
||||
else:
|
||||
result = n.PTransNode
|
||||
let L = n.len-1
|
||||
result[L] = transform(c, n.sons[L])
|
||||
result = PTransNode(n)
|
||||
result[0] = transform(c, n[0])
|
||||
# Skip the second son since it only contains an unsemanticized copy of the
|
||||
# variable type used by docgen
|
||||
result[2] = transform(c, n[2])
|
||||
# XXX comment handling really sucks:
|
||||
if importantComments(c.graph.config):
|
||||
PNode(result).comment = n.comment
|
||||
|
||||
@@ -1244,6 +1244,14 @@ function main() {
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a class="reference reference-toplevel" href="#8" id="58">Vars</a>
|
||||
<ul class="simple simple-toc-section">
|
||||
<li><a class="reference" href="#aVariable"
|
||||
title="aVariable: array[1, int]"><wbr />a<wbr />Variable<span class="attachedType" style="visibility:hidden"></span></a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
||||
<ul class="simple simple-toc-section">
|
||||
@@ -1285,6 +1293,16 @@ function main() {
|
||||
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
||||
<dl class="item">
|
||||
<a class="reference external" href="subdir/subdir_b/utils.html">subdir/subdir_b/utils</a>
|
||||
</dl></div>
|
||||
<div class="section" id="8">
|
||||
<h1><a class="toc-backref" href="#8">Vars</a></h1>
|
||||
<dl class="item">
|
||||
<dt id="aVariable"><a name="aVariable"></a><pre><span class="Identifier">aVariable</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="DecNumber">1</span><span class="Other">,</span> <span class="Identifier">int</span><span class="Other">]</span></pre></dt>
|
||||
<dd>
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
</dl></div>
|
||||
<div class="section" id="12">
|
||||
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
||||
|
||||
@@ -1221,7 +1221,11 @@ function main() {
|
||||
<div class="container">
|
||||
<h1 class="title">Index</h1>
|
||||
Modules: <a href="subdir/subdir_b/utils.html">subdir/subdir_b/utils</a>, <a href="testproject.html">testproject</a>.<br/><p /><h2>API symbols</h2>
|
||||
<dl><dt><a name="bar" href="#bar"><span>bar:</span></a></dt><dd><ul class="simple">
|
||||
<dl><dt><a name="aVariable" href="#aVariable"><span>aVariable:</span></a></dt><dd><ul class="simple">
|
||||
<li><a class="reference external"
|
||||
data-doc-search-tag="testproject: aVariable" href="testproject.html#aVariable">testproject: aVariable</a></li>
|
||||
</ul></dd>
|
||||
<dt><a name="bar" href="#bar"><span>bar:</span></a></dt><dd><ul class="simple">
|
||||
<li><a class="reference external"
|
||||
data-doc-search-tag="testproject: bar[T](a, b: T): T" href="testproject.html#bar,T,T">testproject: bar[T](a, b: T): T</a></li>
|
||||
<li><a class="reference external"
|
||||
|
||||
@@ -20,3 +20,5 @@ import std/macros
|
||||
|
||||
macro bar*(): untyped =
|
||||
result = newStmtList()
|
||||
|
||||
var aVariable*: array[1,int]
|
||||
|
||||
27
tests/let/t7936.nim
Normal file
27
tests/let/t7936.nim
Normal file
@@ -0,0 +1,27 @@
|
||||
discard """
|
||||
action: "run"
|
||||
"""
|
||||
|
||||
import
|
||||
tables, deques, sequtils
|
||||
|
||||
const
|
||||
lookupTable = {'(': ')', '{': '}', '[': ']'}.toTable
|
||||
|
||||
proc isPaired*(value: string): bool =
|
||||
var stack = initDeque[char]()
|
||||
|
||||
for item in value:
|
||||
# echo "Looking at " & item
|
||||
if item in lookupTable:
|
||||
stack.addLast(item)
|
||||
if item in toSeq(lookupTable.values):
|
||||
if stack.len == 0:
|
||||
return false
|
||||
if lookupTable[stack.popLast()] != item:
|
||||
return false
|
||||
|
||||
return stack.len == 0
|
||||
|
||||
doAssert isPaired("{[()]}") == true
|
||||
doAssert isPaired("a)b(c") == false
|
||||
Reference in New Issue
Block a user