summary refs log tree commit diff stats
path: root/compiler/ccgtrav.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-07-13 21:15:47 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-07-13 21:15:47 +0200
commit74bf316619129b3c07c35c796cbc8744cbca87aa (patch)
tree111d8c2b8f0da388df578ecca46f5e61de8f53b4 /compiler/ccgtrav.nim
parent5b59852406e3d4a494186dddf9a5702062901668 (diff)
downloadNim-74bf316619129b3c07c35c796cbc8744cbca87aa.tar.gz
more progress on destructor based strings
Diffstat (limited to 'compiler/ccgtrav.nim')
-rw-r--r--compiler/ccgtrav.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/ccgtrav.nim b/compiler/ccgtrav.nim
index e74d5a953..5a6dc8a6e 100644
--- a/compiler/ccgtrav.nim
+++ b/compiler/ccgtrav.nim
@@ -107,8 +107,11 @@ proc genTraverseProcSeq(c: TTraversalClosure, accessor: Rope, typ: PType) =
   var i: TLoc
   getTemp(p, getSysType(c.p.module.g.graph, unknownLineInfo(), tyInt), i)
   let oldCode = p.s(cpsStmts)
-  lineF(p, cpsStmts, "for ($1 = 0; $1 < $2->$3; $1++) {$n",
-      [i.r, accessor, lenField(c.p)])
+  var a: TLoc
+  a.r = accessor
+
+  lineF(p, cpsStmts, "for ($1 = 0; $1 < $2; $1++) {$n",
+      [i.r, lenExpr(c.p, a)])
   let oldLen = p.s(cpsStmts).len
   genTraverseProc(c, "$1$3[$2]" % [accessor, i.r, dataField(c.p)], typ.sons[0])
   if p.s(cpsStmts).len == oldLen: