summary refs log tree commit diff stats
path: root/compiler/vmdeps.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-12-13 12:18:45 +0100
committerAraq <rumpf_a@web.de>2016-12-13 12:18:45 +0100
commit414c2decbecd5dbaf96ddb28132bddbc7d55a2db (patch)
tree68fb7069d338a8b9d78a18ce73c5e047684a618a /compiler/vmdeps.nim
parent02d39277eb5648bb69380e7d31a0993200fe1c30 (diff)
parent30df9224091152d8209aa937d9029222ea96c663 (diff)
downloadNim-414c2decbecd5dbaf96ddb28132bddbc7d55a2db.tar.gz
Merge branch 'devel' into sighashes
Diffstat (limited to 'compiler/vmdeps.nim')
-rw-r--r--compiler/vmdeps.nim13
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim
index 30b5c17a2..bf02e228c 100644
--- a/compiler/vmdeps.nim
+++ b/compiler/vmdeps.nim
@@ -73,6 +73,10 @@ proc atomicTypeX(name: string; m: TMagic; t: PType; info: TLineInfo): PNode =
   result = newSymNode(sym)
   result.typ = t
 
+proc atomicTypeX(s: PSym; info: TLineInfo): PNode =
+  result = newSymNode(s)
+  result.info = info
+
 proc mapTypeToAstX(t: PType; info: TLineInfo;
                    inst=false; allowRecursionX=false): PNode
 
@@ -103,6 +107,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
                    inst=false; allowRecursionX=false): PNode =
   var allowRecursion = allowRecursionX
   template atomicType(name, m): untyped = atomicTypeX(name, m, t, info)
+  template atomicType(s): untyped = atomicTypeX(s, info)
   template mapTypeToAst(t,info): untyped = mapTypeToAstX(t, info, inst)
   template mapTypeToAstR(t,info): untyped = mapTypeToAstX(t, info, inst, true)
   template mapTypeToAst(t,i,info): untyped =
@@ -125,7 +130,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
       if allowRecursion:  # getTypeImpl behavior: turn off recursion
         allowRecursion = false
       else:  # getTypeInst behavior: return symbol
-        return atomicType(t.sym.name.s, t.sym.magic)
+        return atomicType(t.sym)
 
   case t.kind
   of tyNone: result = atomicType("none", mNone)
@@ -180,9 +185,9 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
       if allowRecursion or t.sym == nil:
         result = mapTypeToBracket("distinct", mDistinct, t, info)
       else:
-        result = atomicType(t.sym.name.s, t.sym.magic)
+        result = atomicType(t.sym)
   of tyGenericParam, tyForward:
-    result = atomicType(t.sym.name.s, t.sym.magic)
+    result = atomicType(t.sym)
   of tyObject:
     if inst:
       result = newNodeX(nkObjectTy)
@@ -206,7 +211,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
           result.add mapTypeToAst(t.sons[0], info)
         result.add copyTree(t.n)
       else:
-        result = atomicType(t.sym.name.s, t.sym.magic)
+        result = atomicType(t.sym)
   of tyEnum:
     result = newNodeIT(nkEnumTy, if t.n.isNil: info else: t.n.info, t)
     result.add copyTree(t.n)