summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorDmitry Atamanov <data-man@users.noreply.github.com>2018-07-09 21:04:57 +0300
committerAndreas Rumpf <rumpf_a@web.de>2018-07-09 20:04:57 +0200
commit854aa3958faa3603ab4ebfc72ea4c275e025a70c (patch)
treefaab21b846cd006d57a98753dfd188b1bb199abb /compiler
parent3b310e91cd592b76cd34678ae394c1af2c3808f3 (diff)
downloadNim-854aa3958faa3603ab4ebfc72ea4c275e025a70c.tar.gz
Fixes maxLineLength's bug in the renderer (#8240)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/renderer.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim
index 3ce2e157d..60ff5ec18 100644
--- a/compiler/renderer.nim
+++ b/compiler/renderer.nim
@@ -189,7 +189,7 @@ proc putComment(g: var TSrcGen, s: string) =
       put(g, tkComment, com)
       com = "## "
       inc(i)
-      if i < s.len and s[i] == '\x0A': inc(i)
+      if i <= hi and s[i] == '\x0A': inc(i)
       optNL(g, ind)
     of '\x0A':
       put(g, tkComment, com)
@@ -226,7 +226,7 @@ proc maxLineLength(s: string): int =
       break
     of '\x0D':
       inc(i)
-      if s[i] == '\x0A': inc(i)
+      if i <= hi and s[i] == '\x0A': inc(i)
       result = max(result, lineLen)
       lineLen = 0
     of '\x0A':
@@ -247,7 +247,7 @@ proc putRawStr(g: var TSrcGen, kind: TTokType, s: string) =
       put(g, kind, str)
       str = ""
       inc(i)
-      if (i <= hi) and (s[i] == '\x0A'): inc(i)
+      if i <= hi and s[i] == '\x0A': inc(i)
       optNL(g, 0)
     of '\x0A':
       put(g, kind, str)