fixes #6532 array bounds check for non zero based arrays on the js backend (#6550)

This commit is contained in:
skilchen 2017-11-06 09:14:28 +01:00 • committed by Andreas Rumpf
commit e4b0818629
2 changed files with 45 additions and 1 deletions

View file

@ -1067,7 +1067,7 @@ proc genArrayAddr(p: PProc, n: PNode, r: var TCompRes) =
else:
r.res = "chckIndx($1, $2, strlen($3))-$2" % [b.res, rope(first), a.res]
else:
r.res = "chckIndx($1, $2, $3.length-1)-$2" % [b.res, rope(first), a.res]
r.res = "chckIndx($1, $2, $3.length+$2-1)-$2" % [b.res, rope(first), a.res]
elif first != 0:
r.res = "($1)-$2" % [b.res, rope(first)]
else: