As of CL 39998, it is no longer necessary.
Fixes #19699
Change-Id: Ie1c49c8468073c6ddeb96c03668705cf81d40c98
Reviewed-on: https://go-review.googlesource.com/41051
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
continue
}
if n.Op == OIF && Isconst(n.Left, CTBOOL) {
- var dead *Nodes
if n.Left.Bool() {
- dead = &n.Rlist
+ n.Rlist = Nodes{}
} else {
- dead = &n.Nbody
- }
- // TODO(mdempsky/josharian): eliminate need for haslabelgoto
- // by checking labels and gotos earlier. See issue 19699.
- if !(*dead).haslabelgoto() {
- *dead = Nodes{}
+ n.Nbody = Nodes{}
}
}
deadcodeslice(n.Ninit)
deadcodeslice(n.Rlist)
}
}
-
-// haslabelgoto reports whether the Nodes list contains any label or goto statements.
-func (l Nodes) haslabelgoto() bool {
- for _, n := range l.Slice() {
- if n == nil {
- continue
- }
- if n.Op == OLABEL || n.Op == OGOTO {
- return true
- }
- if n.Ninit.haslabelgoto() || n.Nbody.haslabelgoto() || n.List.haslabelgoto() || n.Rlist.haslabelgoto() {
- return true
- }
- }
- return false
-}