aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorAlessandro Arzilli <alessandro.arzilli@gmail.com>2018-12-13 17:43:18 +0100
committeralandonovan <adonovan@google.com>2018-12-13 11:43:18 -0500
commit58464401628ac95e2697165f3a7ee27394158f45 (patch)
treed93c6dc2c0d6818547f13fc6ed4c4f9525ad2c7f /internal
parent66ac3a2d309f2b501bdb8f8f32c1e81b43e648e5 (diff)
downloadstarlark-go-58464401628ac95e2697165f3a7ee27394158f45.tar.gz
make break and continue work with while (#71)
* make break and continue work with while break and continue should work inside a while loop instead of causing a compiler panic. * move recursion tests to .star files
Diffstat (limited to 'internal')
-rw-r--r--internal/compile/compile.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/compile/compile.go b/internal/compile/compile.go
index 7ba17eb..0f3f264 100644
--- a/internal/compile/compile.go
+++ b/internal/compile/compile.go
@@ -1086,7 +1086,9 @@ func (fcomp *fcomp) stmt(stmt syntax.Stmt) {
fcomp.ifelse(stmt.Cond, body, done)
fcomp.block = body
+ fcomp.loops = append(fcomp.loops, loop{break_: done, continue_: head})
fcomp.stmts(stmt.Body)
+ fcomp.loops = fcomp.loops[:len(fcomp.loops)-1]
fcomp.jump(head)
fcomp.block = done