summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/layouter.nim5
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) =