Change-Id: I894ee000561a3c6afede8df697b1bce4576ceef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/349012
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Keith Randall <khr@golang.org>
if n.Op() == ir.OBLOCK {
n := n.(*ir.BlockStmt)
list = append(list, n.List...)
- } else {
- list = append(list, n)
+ continue
}
-
+ if len(list) > 0 {
+ // check for an optional label that can only immediately
+ // precede a for/range/select/switch statement.
+ if last := list[len(list)-1]; last.Op() == ir.OLABEL {
+ label := last.(*ir.LabelStmt).Label
+ switch n.Op() {
+ case ir.OFOR:
+ n.(*ir.ForStmt).Label = label
+ case ir.ORANGE:
+ n.(*ir.RangeStmt).Label = label
+ case ir.OSELECT:
+ n.(*ir.SelectStmt).Label = label
+ case ir.OSWITCH:
+ n.(*ir.SwitchStmt).Label = label
+ }
+ }
+ }
+ list = append(list, n)
}
return list
}
"writebarrier.go", // correct diagnostics, but different lines (probably irgen's fault)
"typeparam/nested.go", // -G=3 doesn't support function-local types with generics
-
- "typeparam/mdempsky/4.go", // -G=3 can't export functions with labeled breaks in loops
)
var unifiedFailures = setOf(