fixes #1143
This commit is contained in:
parent
e662013ee0
commit
b5248d9037
3 changed files with 21 additions and 14 deletions
|
|
@ -390,8 +390,8 @@ proc symToYaml(n: PSym, indent: int = 0, maxRecDepth: int = - 1): PRope =
|
|||
var marker = initIntSet()
|
||||
result = symToYamlAux(n, marker, indent, maxRecDepth)
|
||||
|
||||
proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope
|
||||
proc debugType(n: PType): PRope =
|
||||
proc debugTree(n: PNode, indent: int, maxRecDepth: int; renderType=false): PRope
|
||||
proc debugType(n: PType, maxRecDepth=100): PRope =
|
||||
if n == nil:
|
||||
result = toRope("null")
|
||||
else:
|
||||
|
|
@ -399,20 +399,21 @@ proc debugType(n: PType): PRope =
|
|||
if n.sym != nil:
|
||||
app(result, " ")
|
||||
app(result, n.sym.name.s)
|
||||
if (n.kind != tyString) and (sonsLen(n) > 0):
|
||||
if (n.kind != tyString) and (sonsLen(n) > 0) and maxRecDepth != 0:
|
||||
app(result, "(")
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
if i > 0: app(result, ", ")
|
||||
if n.sons[i] == nil:
|
||||
app(result, "null")
|
||||
else:
|
||||
app(result, debugType(n.sons[i]))
|
||||
app(result, debugType(n.sons[i], maxRecDepth-1))
|
||||
if n.kind == tyObject and n.n != nil:
|
||||
app(result, ", node: ")
|
||||
app(result, debugTree(n.n, 2, 100))
|
||||
app(result, debugTree(n.n, 2, maxRecDepth-1, renderType=true))
|
||||
app(result, ")")
|
||||
|
||||
proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope =
|
||||
proc debugTree(n: PNode, indent: int, maxRecDepth: int;
|
||||
renderType=false): PRope =
|
||||
if n == nil:
|
||||
result = toRope("null")
|
||||
else:
|
||||
|
|
@ -436,6 +437,8 @@ proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope =
|
|||
[istr, toRope(n.sym.name.s), toRope(n.sym.id)])
|
||||
# [istr, symToYaml(n.sym, indent, maxRecDepth),
|
||||
# toRope(n.sym.id)])
|
||||
if renderType and n.sym.typ != nil:
|
||||
appf(result, ",$N$1\"typ\": $2", [istr, debugType(n.sym.typ, 2)])
|
||||
of nkIdent:
|
||||
if n.ident != nil:
|
||||
appf(result, ",$N$1\"ident\": $2", [istr, makeYamlString(n.ident.s)])
|
||||
|
|
@ -447,7 +450,7 @@ proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope =
|
|||
for i in countup(0, sonsLen(n) - 1):
|
||||
if i > 0: app(result, ",")
|
||||
appf(result, "$N$1$2", [spaces(indent + 4), debugTree(n.sons[i],
|
||||
indent + 4, maxRecDepth - 1)])
|
||||
indent + 4, maxRecDepth - 1, renderType)])
|
||||
appf(result, "$N$1]", [istr])
|
||||
appf(result, ",$N$1\"info\": $2", [istr, lineInfoToStr(n.info)])
|
||||
appf(result, "$N$1}", [spaces(indent)])
|
||||
|
|
|
|||
|
|
@ -723,7 +723,7 @@ proc discriminatorTableName(m: BModule, objtype: PType, d: PSym): PRope =
|
|||
if objtype.sym == nil:
|
||||
internalError(d.info, "anonymous obj with discriminator")
|
||||
result = ropef("NimDT_$1_$2", [
|
||||
toRope(objtype.sym.name.s.mangle), toRope(d.name.s.mangle)])
|
||||
toRope(objtype.id), toRope(d.name.s.mangle)])
|
||||
|
||||
proc discriminatorTableDecl(m: BModule, objtype: PType, d: PSym): PRope =
|
||||
discard cgsym(m, "TNimNode")
|
||||
|
|
|
|||
|
|
@ -94,6 +94,10 @@ proc getUniqueType*(key: PType): PType =
|
|||
else: result = getUniqueType(lastSon(key))
|
||||
of tyGenericInst, tyOrdinal, tyMutable, tyConst, tyIter, tyStatic:
|
||||
result = getUniqueType(lastSon(key))
|
||||
#let obj = lastSon(key)
|
||||
#if obj.sym != nil and obj.sym.name.s == "TOption":
|
||||
# echo "for ", typeToString(key), " I returned "
|
||||
# debug result
|
||||
of tyArrayConstr, tyGenericInvokation, tyGenericBody,
|
||||
tyOpenArray, tyArray, tySet, tyRange, tyTuple,
|
||||
tyPtr, tyRef, tySequence, tyForward, tyVarargs, tyProxy, tyVar:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue