Skip to content

Commit 9734fd4

Browse files
committed
[dev.regabi] cmd/compile: use node walked flag to prevent double walk for walkSwitch
CL 283672 added a flag to prevent double walking, use that flag instead of checking SwitchStmt.Compiled field. Passes toolstash -cmp. Change-Id: Idb8f9078412fb789f51ed4fc4206638011e38a93 Reviewed-on: https://go-review.googlesource.com/c/go/+/283733 Trust: Cuong Manh Le <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
1 parent f979832 commit 9734fd4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cmd/compile/internal/walk/switch.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import (
1919
// walkSwitch walks a switch statement.
2020
func walkSwitch(sw *ir.SwitchStmt) {
2121
// Guard against double walk, see #25776.
22-
if len(sw.Cases) == 0 && len(sw.Compiled) > 0 {
22+
if sw.Walked() {
2323
return // Was fatal, but eliminating every possible source of double-walking is hard
2424
}
25+
sw.SetWalked(true)
2526

2627
if sw.Tag != nil && sw.Tag.Op() == ir.OTYPESW {
2728
walkSwitchType(sw)

0 commit comments

Comments
 (0)