summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorandri lim <jangko128@gmail.com>2016-01-04 18:07:44 +0700
committerandri lim <jangko128@gmail.com>2016-01-05 07:52:56 +0700
commitaebad711ea64b1e8bba0cbf7c3e0ae8ca8d538f4 (patch)
treebcf76bfe89c3285e181483d2208cf6ddf49e2dfb /compiler
parentec971a2c9de365b0f076a4d724d12b23d672a2ae (diff)
downloadNim-aebad711ea64b1e8bba0cbf7c3e0ae8ca8d538f4.tar.gz
fixed #2240 and #3586
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgcalls.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim
index 86ecc9db8..98a5fe88f 100644
--- a/compiler/ccgcalls.nim
+++ b/compiler/ccgcalls.nim
@@ -118,6 +118,14 @@ proc openArrayLoc(p: BProc, n: PNode): Rope =
         result = "$1->data, $1->$2" % [a.rdLoc, lenField(p)]
     of tyArray, tyArrayConstr:
       result = "$1, $2" % [rdLoc(a), rope(lengthOrd(a.t))]
+    of tyPtr, tyRef:
+      case lastSon(a.t).kind
+      of tyString, tySequence:
+        result = "(*$1)->data, (*$1)->$2" % [a.rdLoc, lenField(p)]
+      of tyArray, tyArrayConstr:
+        result = "$1, $2" % [rdLoc(a), rope(lengthOrd(lastSon(a.t)))]
+      else: 
+        internalError("openArrayLoc: " & typeToString(a.t))
     else: internalError("openArrayLoc: " & typeToString(a.t))
 
 proc genArgStringToCString(p: BProc, n: PNode): Rope {.inline.} =