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:
|
||||
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;
|
||||
inst=false; allowRecursionX=false): PNode =
|
||||
var allowRecursion = allowRecursionX
|
||||
|
|
@ -182,11 +193,8 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
|
|||
var nn = newNodeX(nkOfInherit)
|
||||
nn.add mapTypeToAst(t.sons[0], info)
|
||||
result.add nn
|
||||
if t.n.sons.len>0:
|
||||
var rl = copyNode(t.n) # handle nkRecList
|
||||
for s in t.n.sons:
|
||||
rl.add newIdentDefs(s)
|
||||
result.add rl
|
||||
if t.n.len > 0:
|
||||
result.add objectNode(t.n)
|
||||
else:
|
||||
result.add ast.emptyNode
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue