mirror of
https://github.com/golang/go
synced 2024-11-23 04:00:03 -07:00
c6e82e5808
CL 357649 fixes inlining labeled FOR/RANGE loops, we should do same translation for inlined SWITCH's label Fixes #49145 Change-Id: I9a6f365f57e974271a1eb279b38e81f9b5148788 Reviewed-on: https://go-review.googlesource.com/c/go/+/358315 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
28 lines
357 B
Go
28 lines
357 B
Go
// run
|
|
|
|
// Copyright 2021 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
func f(j int) {
|
|
loop:
|
|
switch j {
|
|
case 1:
|
|
break loop
|
|
default:
|
|
println(j)
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
loop:
|
|
for j := 0; j < 5; j++ {
|
|
f(j)
|
|
if j == 3 {
|
|
break loop
|
|
}
|
|
}
|
|
}
|