summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-05-10 23:26:38 +0200
committerAraq <rumpf_a@web.de>2012-05-10 23:26:38 +0200
commit8cf9b48ad4ca7fbff674f76d0a30f676ae28fc26 (patch)
tree2e7e8b6cc25b9568e0bb232bececf3952105dd3d /compiler
parent63326f19f077554a2e345f65168005ed38b3a15d (diff)
downloadNim-8cf9b48ad4ca7fbff674f76d0a30f676ae28fc26.tar.gz
thoughts about 'continue/break' bug
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/transf.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim
index ff42ff592..569210f2c 100755
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -255,6 +255,10 @@ proc hasContinue(n: PNode): bool =
 proc transformLoopBody(c: PTransf, n: PNode): PTransNode =  
   # XXX BUG: What if it contains "continue" and "break"? "break" needs 
   # an explicit label too, but not the same!
+  
+  # We fix this here by making every 'break' belong to its enclosing loop
+  # and changing all breaks that belong to a 'block' by annotating it with
+  # a label (if it hasn't one already).
   if hasContinue(n):
     var labl = newSym(skLabel, nil, getCurrOwner(c))
     labl.name = getIdent(genPrefix & $labl.id)