As opposed to other symbols, goto labels must be searched in included scopes, not upper ones. Implement scope.lookdown to perform this, to allow calls to goto to be embedded in included scopes where label is defined. Fixes #953.
13 lines
95 B
Go
13 lines
95 B
Go
package main
|
|
|
|
func main() {
|
|
if true {
|
|
goto here
|
|
}
|
|
here:
|
|
println("ok")
|
|
}
|
|
|
|
// Output:
|
|
// ok
|