summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-09-16 11:36:49 +0200
committerAraq <rumpf_a@web.de>2015-09-16 11:36:49 +0200
commitc9a2fa54c7055c16892e9664dd64d8fc68918c07 (patch)
treeb67fca3d93765f677de696f4f8b1ed50b031b164 /compiler
parent1251fc76c32bdd50a3b9540e0cd80b0c435051ce (diff)
parentd24eaf084b4be17e43f262d4127a91993ae6f7cd (diff)
downloadNim-c9a2fa54c7055c16892e9664dd64d8fc68918c07.tar.gz
Merge branch 'devel' into fix_bracket_expr
Diffstat (limited to 'compiler')
-rw-r--r--compiler/aliases.nim2
-rw-r--r--compiler/jstypes.nim5
-rw-r--r--compiler/vm.nim13
3 files changed, 15 insertions, 5 deletions
diff --git a/compiler/aliases.nim b/compiler/aliases.nim
index 3d3fc9a79..4b592ee60 100644
--- a/compiler/aliases.nim
+++ b/compiler/aliases.nim
@@ -146,7 +146,7 @@ proc isPartOf*(a, b: PNode): TAnalysisResult =
     # go down recursively; this is quite demanding:
     const
       Ix0Kinds = {nkDotExpr, nkBracketExpr, nkObjUpConv, nkObjDownConv,
-                  nkCheckedFieldExpr}
+                  nkCheckedFieldExpr, nkHiddenAddr}
       Ix1Kinds = {nkHiddenStdConv, nkHiddenSubConv, nkConv}
       DerefKinds = {nkHiddenDeref, nkDerefExpr}
     case b.kind
diff --git a/compiler/jstypes.nim b/compiler/jstypes.nim
index 851938327..832d9996c 100644
--- a/compiler/jstypes.nim
+++ b/compiler/jstypes.nim
@@ -116,8 +116,7 @@ proc genEnumInfo(p: PProc, typ: PType, name: Rope) =
          [name, genTypeInfo(p, typ.sons[0])])
 
 proc genTypeInfo(p: PProc, typ: PType): Rope =
-  var t = typ
-  if t.kind == tyGenericInst: t = lastSon(t)
+  let t = typ.skipTypes({tyGenericInst})
   result = "NTI$1" % [rope(t.id)]
   if containsOrIncl(p.g.typeInfoGenerated, t.id): return
   case t.kind
@@ -141,7 +140,7 @@ proc genTypeInfo(p: PProc, typ: PType): Rope =
               [result, rope(ord(t.kind))]
     prepend(p.g.typeInfo, s)
     addf(p.g.typeInfo, "$1.base = $2;$n",
-         [result, genTypeInfo(p, typ.sons[1])])
+         [result, genTypeInfo(p, t.sons[1])])
   of tyEnum: genEnumInfo(p, t, result)
   of tyObject: genObjectInfo(p, t, result)
   of tyTuple: genTupleInfo(p, t, result)
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 0db287c6a..4dd3b5232 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -320,8 +320,19 @@ proc opConv*(dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType): bool =
       dest.node.strVal = if src.intVal == 0: "false" else: "true"
     of tyFloat..tyFloat128:
       dest.node.strVal = $src.floatVal
-    of tyString, tyCString:
+    of tyString:
       dest.node.strVal = src.node.strVal
+    of tyCString:
+      if src.node.kind == nkBracket:
+        # Array of chars
+        var strVal = ""
+        for son in src.node.sons:
+          let c = char(son.intVal)
+          if c == '\0': break
+          strVal.add(c)
+        dest.node.strVal = strVal
+      else:
+        dest.node.strVal = src.node.strVal
     of tyChar:
       dest.node.strVal = $chr(src.intVal)
     else: