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.
25 lines
326 B
Go
25 lines
326 B
Go
package main
|
|
|
|
func main() {
|
|
n := 2
|
|
m := 2
|
|
foo := true
|
|
OuterLoop:
|
|
println("boo")
|
|
for i := 0; i < n; i++ {
|
|
println("I: ", i)
|
|
for j := 0; j < m; j++ {
|
|
switch foo {
|
|
case true:
|
|
println(foo)
|
|
continue OuterLoop
|
|
case false:
|
|
println(foo)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Error:
|
|
// 15:5: invalid continue label OuterLoop
|