summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgutils.nim2
-rw-r--r--compiler/vmdeps.nim9
2 files changed, 8 insertions, 3 deletions
diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim
index 46a9177ad..ff8f768bd 100644
--- a/compiler/ccgutils.nim
+++ b/compiler/ccgutils.nim
@@ -181,7 +181,7 @@ proc mangle*(name: string): string =
     of '_':
       # we generate names like 'foo_9' for scope disambiguations and so
       # disallow this here:
-      if i < name.len-1 and name[i+1] in Digits:
+      if i > 0 and i < name.len-1 and name[i+1] in Digits:
         discard
       else:
         add(result, c)
diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim
index ebd2f557f..779d6d2a4 100644
--- a/compiler/vmdeps.nim
+++ b/compiler/vmdeps.nim
@@ -218,8 +218,13 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
   of tyTuple:
     if inst:
       result = newNodeX(nkTupleTy)
-      for s in t.n.sons:
-        result.add newIdentDefs(s)
+      # only named tuples have a node, unnamed tuples don't
+      if t.n.isNil:
+        for subType in t.sons:
+          result.add mapTypeToAst(subType, info)
+      else:
+        for s in t.n.sons:
+          result.add newIdentDefs(s)
     else:
       result = mapTypeToBracket("tuple", mTuple, t, info)
   of tySet: result = mapTypeToBracket("set", mSet, t, info)