mirror of
https://github.com/traefik/yaegi.git
synced 2026-06-01 18:37:56 +00:00
The logic of goto was false due to mixing break label and goto label, despite being opposite. In case of break, jump to node (the exit point) instead of node.start. Also always define label symbols before their use is parsed. * Fix continue label, detect invalid labels for break and continue * fix multiple goto, break, continue to the same label Fixes #1354.
26 lines
306 B
Go
26 lines
306 B
Go
package main
|
|
|
|
func main() {
|
|
n := 2
|
|
m := 2
|
|
foo := true
|
|
OuterLoop:
|
|
for i := 0; i < n; i++ {
|
|
println("I: ", i)
|
|
for j := 0; j < m; j++ {
|
|
switch foo {
|
|
case true:
|
|
println(foo)
|
|
break OuterLoop
|
|
case false:
|
|
println(foo)
|
|
continue OuterLoop
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Output:
|
|
// I: 0
|
|
// true
|