1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:30:06 -07:00

[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 <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2021-01-14 13:41:35 +07:00
parent f97983249a
commit 9734fd482d

View File

@ -19,9 +19,10 @@ import (
// walkSwitch walks a switch statement.
func walkSwitch(sw *ir.SwitchStmt) {
// Guard against double walk, see #25776.
if len(sw.Cases) == 0 && len(sw.Compiled) > 0 {
if sw.Walked() {
return // Was fatal, but eliminating every possible source of double-walking is hard
}
sw.SetWalked(true)
if sw.Tag != nil && sw.Tag.Op() == ir.OTYPESW {
walkSwitchType(sw)