diff options
author | Araq <rumpf_a@web.de> | 2015-03-16 17:27:44 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-03-16 23:02:19 +0100 |
commit | f9a3de984d17f2a9a7fc056d3f35b2c9987952d3 (patch) | |
tree | ca6ad28a9bf4acef881e8b5e2df4ad64aa85be42 | |
parent | 13cdad88197ded8e0a81b990dd877848b9e50c10 (diff) | |
download | Nim-f9a3de984d17f2a9a7fc056d3f35b2c9987952d3.tar.gz |
macros.getType() works properly for distinct types
-rw-r--r-- | compiler/vmdeps.nim | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index 11d839c41..2b80f6aed 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -28,7 +28,7 @@ proc opGorge*(cmd, input: string): string = except IOError, OSError: result = "" -proc opSlurp*(file: string, info: TLineInfo, module: PSym): string = +proc opSlurp*(file: string, info: TLineInfo, module: PSym): string = try: let filename = file.findFile result = readFile(filename) @@ -87,7 +87,12 @@ proc mapTypeToAst(t: PType, info: TLineInfo; allowRecursion=false): PNode = result.add mapTypeToAst(t.sons[i], info) of tyGenericInst, tyGenericBody, tyOrdinal, tyUserTypeClassInst: 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: if allowRecursion: result = newNodeIT(nkObjectTy, info, t) |