fixes #4526
This commit is contained in:
parent
64663387db
commit
e8aa6f6c30
1 changed files with 15 additions and 7 deletions
|
|
@ -85,6 +85,17 @@ proc mapTypeToBracketX(name: string; m: TMagic; t: PType; info: TLineInfo;
|
||||||
else:
|
else:
|
||||||
result.add mapTypeToAstX(t.sons[i], info, inst)
|
result.add mapTypeToAstX(t.sons[i], info, inst)
|
||||||
|
|
||||||
|
proc objectNode(n: PNode): PNode =
|
||||||
|
if n.kind == nkSym:
|
||||||
|
result = newNodeI(nkIdentDefs, n.info)
|
||||||
|
result.add n # name
|
||||||
|
result.add mapTypeToAstX(n.sym.typ, n.info, true, false) # type
|
||||||
|
result.add ast.emptyNode # no assigned value
|
||||||
|
else:
|
||||||
|
result = copyNode(n)
|
||||||
|
for i in 0 ..< n.safeLen:
|
||||||
|
result.add objectNode(n[i])
|
||||||
|
|
||||||
proc mapTypeToAstX(t: PType; info: TLineInfo;
|
proc mapTypeToAstX(t: PType; info: TLineInfo;
|
||||||
inst=false; allowRecursionX=false): PNode =
|
inst=false; allowRecursionX=false): PNode =
|
||||||
var allowRecursion = allowRecursionX
|
var allowRecursion = allowRecursionX
|
||||||
|
|
@ -182,11 +193,8 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
|
||||||
var nn = newNodeX(nkOfInherit)
|
var nn = newNodeX(nkOfInherit)
|
||||||
nn.add mapTypeToAst(t.sons[0], info)
|
nn.add mapTypeToAst(t.sons[0], info)
|
||||||
result.add nn
|
result.add nn
|
||||||
if t.n.sons.len>0:
|
if t.n.len > 0:
|
||||||
var rl = copyNode(t.n) # handle nkRecList
|
result.add objectNode(t.n)
|
||||||
for s in t.n.sons:
|
|
||||||
rl.add newIdentDefs(s)
|
|
||||||
result.add rl
|
|
||||||
else:
|
else:
|
||||||
result.add ast.emptyNode
|
result.add ast.emptyNode
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue