diff options
author | narimiran <narimiran@disroot.org> | 2019-07-04 12:02:35 +0200 |
---|---|---|
committer | narimiran <narimiran@disroot.org> | 2019-07-04 12:02:35 +0200 |
commit | 4450fca6fdf3b0218783f0615a62e64ab93be550 (patch) | |
tree | fe2e90a94d5e38921289c82d9c95d599644544d0 /compiler | |
parent | a59f0adc50756d8b65135fa6ef713717867291bf (diff) | |
download | Nim-4450fca6fdf3b0218783f0615a62e64ab93be550.tar.gz |
nimpretty: fix out of bounds error [ci skip]
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/layouter.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/layouter.nim b/compiler/layouter.nim index 7d0152122..724e827cc 100644 --- a/compiler/layouter.nim +++ b/compiler/layouter.nim @@ -250,8 +250,9 @@ proc wrTab(em: var Emitter) = wr(em, " ", ltTab) proc beginSection*(em: var Emitter) = - em.tokens.insert "", em.tokens.len-2 - em.kinds.insert ltBeginSection, em.kinds.len-2 + let pos = max(0, em.tokens.len-2) + em.tokens.insert "", pos + em.kinds.insert ltBeginSection, pos #wr(em, "", ltBeginSection) proc endSection*(em: var Emitter) = |