From aebad711ea64b1e8bba0cbf7c3e0ae8ca8d538f4 Mon Sep 17 00:00:00 2001 From: andri lim Date: Mon, 4 Jan 2016 18:07:44 +0700 Subject: fixed #2240 and #3586 --- compiler/ccgcalls.nim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/ccgcalls.nim') 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.} = -- cgit 1.4.1-2-gfad0