summary refs log tree commit diff stats
path: root/compiler/ccgcalls.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-08-29 19:09:54 +0200
committerGitHub <noreply@github.com>2019-08-29 19:09:54 +0200
commit2a3b0563141f2cfdee4cbeef85167c25610ff71f (patch)
tree2a32c413877f8e83d4f92e3a922b4aaef83250c9 /compiler/ccgcalls.nim
parentd0e5bd2305db719b0c9acb6a017c8aa579a2f246 (diff)
downloadNim-2a3b0563141f2cfdee4cbeef85167c25610ff71f.tar.gz
fixes #12042 (#12083)
* fixes #12042

* make tests green again
Diffstat (limited to 'compiler/ccgcalls.nim')
-rw-r--r--compiler/ccgcalls.nim12
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim
index 2ae56863b..4efd33d1e 100644
--- a/compiler/ccgcalls.nim
+++ b/compiler/ccgcalls.nim
@@ -79,9 +79,19 @@ proc genBoundsCheck(p: BProc; arr, a, b: TLoc)
 proc openArrayLoc(p: BProc, n: PNode): Rope =
   var a: TLoc
 
-  let q = skipConv(n)
+  var q = skipConv(n)
+  var skipped = false
+  while q.kind == nkStmtListExpr and q.len > 0:
+    skipped = true
+    q = q.lastSon
   if getMagic(q) == mSlice:
     # magic: pass slice to openArray:
+    if skipped:
+      q = skipConv(n)
+      while q.kind == nkStmtListExpr and q.len > 0:
+        for i in 0..q.len-2:
+          genStmts(p, q[i])
+        q = q.lastSon
     var b, c: TLoc
     initLocExpr(p, q[1], a)
     initLocExpr(p, q[2], b)