macros.getType() works properly for distinct types
This commit is contained in:
parent
13cdad8819
commit
f9a3de984d
1 changed files with 7 additions and 2 deletions
|
|
@ -28,7 +28,7 @@ proc opGorge*(cmd, input: string): string =
|
||||||
except IOError, OSError:
|
except IOError, OSError:
|
||||||
result = ""
|
result = ""
|
||||||
|
|
||||||
proc opSlurp*(file: string, info: TLineInfo, module: PSym): string =
|
proc opSlurp*(file: string, info: TLineInfo, module: PSym): string =
|
||||||
try:
|
try:
|
||||||
let filename = file.findFile
|
let filename = file.findFile
|
||||||
result = readFile(filename)
|
result = readFile(filename)
|
||||||
|
|
@ -87,7 +87,12 @@ proc mapTypeToAst(t: PType, info: TLineInfo; allowRecursion=false): PNode =
|
||||||
result.add mapTypeToAst(t.sons[i], info)
|
result.add mapTypeToAst(t.sons[i], info)
|
||||||
of tyGenericInst, tyGenericBody, tyOrdinal, tyUserTypeClassInst:
|
of tyGenericInst, tyGenericBody, tyOrdinal, tyUserTypeClassInst:
|
||||||
result = mapTypeToAst(t.lastSon, info)
|
result = mapTypeToAst(t.lastSon, info)
|
||||||
of tyGenericParam, tyDistinct, tyForward: result = atomicType(t.sym.name.s)
|
of tyDistinct:
|
||||||
|
if allowRecursion:
|
||||||
|
result = mapTypeToBracket("distinct", t, info)
|
||||||
|
else:
|
||||||
|
result = atomicType(t.sym.name.s)
|
||||||
|
of tyGenericParam, tyForward: result = atomicType(t.sym.name.s)
|
||||||
of tyObject:
|
of tyObject:
|
||||||
if allowRecursion:
|
if allowRecursion:
|
||||||
result = newNodeIT(nkObjectTy, info, t)
|
result = newNodeIT(nkObjectTy, info, t)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue